home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / app / preferences_dialog.c < prev    next >
Encoding:
C/C++ Source or Header  |  2003-01-15  |  86.2 KB  |  2,599 lines

  1. /* The GIMP -- an image manipulation program
  2.  * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
  3.  *
  4.  * This program is free software; you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation; either version 2 of the License, or
  7.  * (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17.  */
  18.  
  19. #include "config.h"
  20.  
  21. #include <string.h>
  22.  
  23. #include <glib.h>
  24.  
  25. #include "apptypes.h"
  26.  
  27. #include "appenv.h"
  28. #include "colormaps.h"
  29. #include "context_manager.h"
  30. #include "cursorutil.h"
  31. #include "gdisplay_ops.h"
  32. #include "gdisplay.h"
  33. #include "gimprc.h"
  34. #include "gimpui.h"
  35. #include "image_render.h"
  36. #include "lc_dialog.h"
  37. #include "layer_select.h"
  38. #include "resolution_calibrate.h"
  39. #include "session.h"
  40. #include "tile_cache.h"
  41.  
  42. #include "libgimp/gimplimits.h"
  43. #include "libgimp/gimpmath.h"
  44.  
  45. #include "libgimp/gimpintl.h"
  46.  
  47. /* gimprc will be parsed with a buffer size of 1024, 
  48.    so don't set this too large */
  49. #define MAX_COMMENT_LENGTH 512
  50.  
  51. typedef enum
  52. {
  53.   PREFS_OK,
  54.   PREFS_CORRUPT,
  55.   PREFS_RESTART
  56. } PrefsState;
  57.  
  58.  
  59. /*  preferences local functions  */
  60. static PrefsState  prefs_check_settings          (void);
  61. static void        prefs_ok_callback             (GtkWidget *widget,
  62.                           GtkWidget *dlg);
  63. static void        prefs_save_callback           (GtkWidget *widget,
  64.                           GtkWidget *dlg);
  65. static void        prefs_cancel_callback         (GtkWidget *widget,
  66.                           GtkWidget *dlg);
  67.  
  68. static void  prefs_toggle_callback               (GtkWidget *widget,
  69.                           gpointer   data);
  70. static void  prefs_preview_size_callback         (GtkWidget *widget,
  71.                           gpointer   data);
  72. static void  prefs_nav_preview_size_callback     (GtkWidget *widget,
  73.                           gpointer   data);
  74. static void  prefs_string_callback               (GtkWidget *widget,
  75.                           gpointer   data);
  76. static void  prefs_text_callback                 (GtkWidget *widget,
  77.                           gpointer   data);
  78. static void  prefs_filename_callback             (GtkWidget *widget,
  79.                           gpointer   data);
  80. static void  prefs_path_callback                 (GtkWidget *widget,
  81.                           gpointer   data);
  82. static void  prefs_clear_session_info_callback   (GtkWidget *widget,
  83.                           gpointer   data);
  84. static void  prefs_default_size_callback         (GtkWidget *widget,
  85.                           gpointer   data);
  86. static void  prefs_default_resolution_callback   (GtkWidget *widget,
  87.                           gpointer   data);
  88. static void  prefs_res_source_callback           (GtkWidget *widget,
  89.                           gpointer   data);
  90. static void  prefs_monitor_resolution_callback   (GtkWidget *widget,
  91.                           gpointer   data);
  92. static void  prefs_resolution_calibrate_callback (GtkWidget *widget,
  93.                           gpointer   data);
  94. static void  prefs_restart_notification          (void);
  95.  
  96.  
  97. /*  static variables  */
  98. static gint               old_perfectmouse;
  99. static gint               old_transparency_type;
  100. static gint               old_transparency_size;
  101. static gint               old_levels_of_undo;
  102. static gint               old_marching_speed;
  103. static gint               old_allow_resize_windows;
  104. static gint               old_auto_save;
  105. static gint               old_preview_size;
  106. static gint               old_nav_preview_size;
  107. static gint               old_no_cursor_updating;
  108. static gint               old_show_tool_tips;
  109. static gint               old_show_rulers;
  110. static gint               old_show_statusbar;
  111. static InterpolationType  old_interpolation_type;
  112. static gint               old_confirm_on_close;
  113. static gint               old_save_session_info;
  114. static gint               old_save_device_status;
  115. static gint               old_always_restore_session;
  116. static gint               old_default_width;
  117. static gint               old_default_height;
  118. static GimpUnit           old_default_units;
  119. static gdouble            old_default_xresolution;
  120. static gdouble            old_default_yresolution;
  121. static GimpUnit           old_default_resolution_units;
  122. static gint               old_default_type;
  123. static gchar *            old_default_comment;
  124. static gint               old_default_dot_for_dot;
  125. static gint               old_stingy_memory_use;
  126. static guint              old_tile_cache_size;
  127. static gint               old_min_colors;
  128. static gint               old_install_cmap;
  129. static gint               old_cycled_marching_ants;
  130. static gint               old_last_opened_size;
  131. static gchar *            old_temp_path;
  132. static gchar *            old_swap_path;
  133. static gchar *            old_plug_in_path;
  134. static gchar *            old_module_path;
  135. static gchar *            old_brush_path;
  136. static gchar *            old_brush_vbr_path;
  137. static gchar *            old_pattern_path;
  138. static gchar *            old_palette_path;
  139. static gchar *            old_gradient_path;
  140. static gdouble            old_monitor_xres;
  141. static gdouble            old_monitor_yres;
  142. static gint               old_using_xserver_resolution;
  143. static gint               old_num_processors;
  144. static gchar *            old_image_title_format;
  145. static gint               old_global_paint_options;
  146. static guint              old_max_new_image_size;
  147. static gint               old_thumbnail_mode;
  148. static gint               old_show_indicators;
  149. static gint              old_trust_dirty_flag;
  150. static gint               old_use_help;
  151. static gint               old_nav_window_per_display;
  152. static gint               old_info_window_follows_mouse;
  153. static gint               old_help_browser;
  154. static gint               old_cursor_mode;
  155. static gint               old_default_threshold;
  156.  
  157. /*  variables which can't be changed on the fly  */
  158. static gint               edit_stingy_memory_use;
  159. static gint               edit_min_colors;
  160. static gint               edit_install_cmap;
  161. static gint               edit_cycled_marching_ants;
  162. static gint               edit_last_opened_size;
  163. static gint               edit_show_indicators;
  164. static gint               edit_nav_window_per_display;
  165. static gint               edit_info_window_follows_mouse;
  166. static gchar *            edit_temp_path      = NULL;
  167. static gchar *            edit_swap_path      = NULL;
  168. static gchar *            edit_brush_path     = NULL;
  169. static gchar *            edit_brush_vbr_path = NULL;
  170. static gchar *            edit_pattern_path   = NULL;
  171. static gchar *            edit_palette_path   = NULL;
  172. static gchar *            edit_gradient_path  = NULL;
  173. static gchar *            edit_plug_in_path   = NULL;
  174. static gchar *            edit_module_path    = NULL;
  175.  
  176. /*  variables which will be changed _after_ closing the dialog  */
  177. static guint              edit_tile_cache_size;
  178.  
  179. static GtkWidget *        prefs_dlg = NULL;
  180.  
  181.  
  182. /* Some information regarding preferences, compiled by Raph Levien 11/3/97.
  183.    updated by Michael Natterer 27/3/99
  184.  
  185.    The following preference items cannot be set on the fly (at least
  186.    according to the existing pref code - it may be that changing them
  187.    so they're set on the fly is not hard).
  188.  
  189.    stingy-memory-use
  190.    min-colors
  191.    install-cmap
  192.    cycled-marching-ants
  193.    last-opened-size
  194.    show-indicators
  195.    nav-window-per-display
  196.    info_window_follows_mouse
  197.    temp-path
  198.    swap-path
  199.    brush-path
  200.    pattern-path
  201.    palette-path
  202.    gradient-path
  203.    plug-in-path
  204.    module-path
  205.  
  206.    All of these now have variables of the form edit_temp_path, which
  207.    are copied from the actual variables (e.g. temp_path) the first time
  208.    the dialog box is started.
  209.  
  210.    Variables of the form old_temp_path represent the values at the
  211.    time the dialog is opened - a cancel copies them back from old to
  212.    the real variables or the edit variables, depending on whether they
  213.    can be set on the fly.
  214.  
  215.    Here are the remaining issues as I see them:
  216.  
  217.    Still no settings for default-gradient, default-palette,
  218.    gamma-correction.
  219.  
  220.    No widget for confirm-on-close although a lot of stuff is there.
  221.  
  222.    The semantics of "save" are a little funny - it only saves the
  223.    settings that are different from the way they were when the dialog
  224.    was opened. So you can set something, close the window, open it
  225.    up again, click "save" and have nothing happen. To change this
  226.    to more intuitive semantics, we should have a whole set of init_
  227.    variables that are set the first time the dialog is opened (along
  228.    with the edit_ variables that are currently set). Then, the save
  229.    callback checks against the init_ variable rather than the old_.
  230. */
  231.  
  232. /*  Copy the string from source to destination, freeing the string stored
  233.  *  in the destination if there is one there already.
  234.  */
  235. static void
  236. prefs_strset (gchar **dst,
  237.            gchar  *src)
  238. {
  239.   if (*dst)
  240.     g_free (*dst);
  241.  
  242.   *dst = g_strdup (src);
  243. }
  244.  
  245. /*  Duplicate the string, but treat NULL as the empty string.  */
  246. static gchar *
  247. prefs_strdup (gchar *src)
  248. {
  249.   return g_strdup (src == NULL ? "" : src);
  250. }
  251.  
  252. /*  Compare two strings, but treat NULL as the empty string.  */
  253. static int
  254. prefs_strcmp (gchar *src1,
  255.            gchar *src2)
  256. {
  257.   return strcmp (src1 == NULL ? "" : src1,
  258.          src2 == NULL ? "" : src2);
  259. }
  260.  
  261. static PrefsState
  262. prefs_check_settings (void)
  263. {
  264.   /*  First, check for invalid values...  */
  265.   if (levels_of_undo < 0) 
  266.     {
  267.       g_message (_("Error: Levels of undo must be zero or greater."));
  268.       levels_of_undo = old_levels_of_undo;
  269.       return PREFS_CORRUPT;
  270.     }
  271.   if (marching_speed < 50)
  272.     {
  273.       g_message (_("Error: Marching speed must be 50 or greater."));
  274.       marching_speed = old_marching_speed;
  275.       return PREFS_CORRUPT;
  276.     }
  277.   if (default_width < 1)
  278.     {
  279.       g_message (_("Error: Default width must be one or greater."));
  280.       default_width = old_default_width;
  281.       return PREFS_CORRUPT;
  282.     }
  283.   if (default_height < 1)
  284.     {
  285.       g_message (_("Error: Default height must be one or greater."));
  286.       default_height = old_default_height;
  287.       return PREFS_CORRUPT;
  288.     }
  289.   if (default_units < GIMP_UNIT_INCH ||
  290.       default_units >= gimp_unit_get_number_of_units ())
  291.     {
  292.       g_message (_("Error: Default unit must be within unit range."));
  293.       default_units = old_default_units;
  294.       return PREFS_CORRUPT;
  295.     }
  296.   if (default_xresolution < GIMP_MIN_RESOLUTION ||
  297.       default_yresolution < GIMP_MIN_RESOLUTION)
  298.     {
  299.       g_message (_("Error: Default resolution must not be zero."));
  300.       default_xresolution = old_default_xresolution;
  301.       default_yresolution = old_default_yresolution;
  302.       return PREFS_CORRUPT;
  303.     }
  304.   if (default_resolution_units < GIMP_UNIT_INCH ||
  305.       default_resolution_units >= gimp_unit_get_number_of_units ())
  306.     {
  307.       g_message (_("Error: Default resolution unit must be within unit range."));
  308.       default_resolution_units = old_default_resolution_units;
  309.       return PREFS_CORRUPT;
  310.     }
  311.   if (monitor_xres < GIMP_MIN_RESOLUTION ||
  312.       monitor_yres < GIMP_MIN_RESOLUTION)
  313.     {
  314.       g_message (_("Error: Monitor resolution must not be zero."));
  315.       monitor_xres = old_monitor_xres;
  316.       monitor_yres = old_monitor_yres;
  317.       return PREFS_CORRUPT;
  318.     }
  319.   if (image_title_format == NULL)
  320.     {
  321.       g_message (_("Error: Image title format must not be NULL."));
  322.       image_title_format = old_image_title_format;
  323.       return PREFS_CORRUPT;
  324.     }
  325.  
  326.   if (num_processors < 1 || num_processors > 30) 
  327.     {
  328.       g_message (_("Error: Number of processors must be between 1 and 30."));
  329.       num_processors = old_num_processors;
  330.       return PREFS_CORRUPT;
  331.     }
  332.  
  333.   /*  ...then check if we need a restart notification  */
  334.   if (edit_stingy_memory_use         != old_stingy_memory_use         ||
  335.       edit_min_colors                != old_min_colors                ||
  336.       edit_install_cmap              != old_install_cmap              ||
  337.       edit_cycled_marching_ants      != old_cycled_marching_ants      ||
  338.       edit_last_opened_size          != old_last_opened_size          ||
  339.       edit_show_indicators           != old_show_indicators           ||
  340.       edit_nav_window_per_display    != old_nav_window_per_display    ||
  341.       edit_info_window_follows_mouse != old_info_window_follows_mouse ||
  342.  
  343.       prefs_strcmp (old_temp_path,      edit_temp_path)      ||
  344.       prefs_strcmp (old_swap_path,      edit_swap_path)      ||
  345.       prefs_strcmp (old_brush_path,     edit_brush_path)     ||
  346.       prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path) ||
  347.       prefs_strcmp (old_pattern_path,   edit_pattern_path)   ||
  348.       prefs_strcmp (old_palette_path,   edit_palette_path)   ||
  349.       prefs_strcmp (old_gradient_path,  edit_gradient_path)  ||
  350.       prefs_strcmp (old_plug_in_path,   edit_plug_in_path)   ||
  351.       prefs_strcmp (old_module_path,    edit_module_path))
  352.     {
  353.       return PREFS_RESTART;
  354.     }
  355.  
  356.   return PREFS_OK;
  357. }
  358.  
  359. static void
  360. prefs_restart_notification_save_callback (GtkWidget *widget,
  361.                            gpointer   data)
  362. {
  363.   prefs_save_callback (widget, prefs_dlg);
  364.   gtk_widget_destroy (GTK_WIDGET (data));
  365. }
  366.  
  367. /*  The user pressed OK and not Save, but has changed some settings that
  368.  *  only take effect after he restarts the GIMP. Allow him to save the
  369.  *  settings.
  370.  */
  371. static void
  372. prefs_restart_notification (void)
  373. {
  374.   GtkWidget *dlg;
  375.   GtkWidget *hbox;
  376.   GtkWidget *label;
  377.  
  378.   dlg = gimp_dialog_new (_("Save Preferences ?"), "gimp_message",
  379.              gimp_standard_help_func,
  380.              "dialogs/preferences/preferences.html",
  381.              GTK_WIN_POS_MOUSE,
  382.              FALSE, FALSE, FALSE,
  383.  
  384.              _("Save"), prefs_restart_notification_save_callback,
  385.              NULL, NULL, NULL, TRUE, FALSE,
  386.              _("Close"), gtk_widget_destroy,
  387.              NULL, 1, NULL, FALSE, TRUE,
  388.  
  389.              NULL);
  390.  
  391.   gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
  392.               GTK_SIGNAL_FUNC (gtk_main_quit),
  393.               NULL);
  394.  
  395.   hbox = gtk_hbox_new (FALSE, 4);
  396.   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, FALSE, 4);
  397.   gtk_widget_show (hbox);
  398.  
  399.   label = gtk_label_new (_("At least one of the changes you made will only\n"
  400.                "take effect after you restart the GIMP.\n\n"
  401.                            "You may choose 'Save' now to make your changes\n"
  402.                "permanent, so you can restart GIMP or hit 'Close'\n"
  403.                "and the critical parts of your changes will not\n"
  404.                "be applied."));
  405.   gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
  406.   gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 4);
  407.   gtk_widget_show (label);
  408.  
  409.   gtk_widget_show (dlg);
  410.  
  411.   gtk_main ();
  412. }
  413.  
  414. static void
  415. prefs_ok_callback (GtkWidget *widget,
  416.             GtkWidget *dlg)
  417. {
  418.   PrefsState state;
  419.  
  420.   state = prefs_check_settings ();
  421.   switch (state)
  422.     {
  423.     case PREFS_CORRUPT:
  424.       return;
  425.       break;
  426.  
  427.     case PREFS_RESTART:
  428.       gtk_widget_set_sensitive (prefs_dlg, FALSE);
  429.       prefs_restart_notification ();
  430.       break;
  431.  
  432.     case PREFS_OK:
  433.       if (show_tool_tips)
  434.     gimp_help_enable_tooltips ();
  435.       else
  436.     gimp_help_disable_tooltips ();
  437.  
  438.       if (edit_tile_cache_size != old_tile_cache_size)
  439.     {
  440.       tile_cache_size = edit_tile_cache_size;
  441.       tile_cache_set_size (edit_tile_cache_size);
  442.     }
  443.       break;
  444.  
  445.     default:
  446.       break;
  447.     }
  448.  
  449.   if (prefs_dlg)
  450.     {
  451.       gtk_widget_destroy (prefs_dlg);
  452.       prefs_dlg = NULL;
  453.     }
  454. }
  455.  
  456. static void
  457. prefs_save_callback (GtkWidget *widget,
  458.               GtkWidget *dlg)
  459. {
  460.   GList *update = NULL; /*  options that should be updated in .gimprc  */
  461.   GList *remove = NULL; /*  options that should be commented out       */
  462.  
  463.   PrefsState state;
  464.  
  465.   gint   save_stingy_memory_use;
  466.   gint   save_min_colors;
  467.   gint   save_install_cmap;
  468.   gint   save_cycled_marching_ants;
  469.   gint   save_last_opened_size;
  470.   gint   save_show_indicators;
  471.   gint   save_nav_window_per_display;
  472.   gint   save_info_window_follows_mouse;
  473.   gchar *save_temp_path;
  474.   gchar *save_swap_path;
  475.   gchar *save_plug_in_path;
  476.   gchar *save_module_path;
  477.   gchar *save_brush_path;
  478.   gchar *save_brush_vbr_path;
  479.   gchar *save_pattern_path;
  480.   gchar *save_palette_path;
  481.   gchar *save_gradient_path;
  482.  
  483.   state = prefs_check_settings ();
  484.   switch (state)
  485.     {
  486.     case PREFS_CORRUPT:
  487.       return;
  488.       break;
  489.  
  490.     case PREFS_RESTART:
  491.       gtk_widget_set_sensitive (prefs_dlg, FALSE);
  492.       g_message (_("You will need to restart GIMP for these "
  493.            "changes to take effect."));
  494.       /* don't break */
  495.  
  496.     case PREFS_OK:
  497.       if (show_tool_tips)
  498.     gimp_help_enable_tooltips ();
  499.       else
  500.     gimp_help_disable_tooltips ();
  501.  
  502.       if (edit_tile_cache_size != old_tile_cache_size)
  503.     tile_cache_set_size (edit_tile_cache_size);
  504.       break;
  505.  
  506.     default:
  507.       break;
  508.     }
  509.  
  510.   gtk_widget_destroy (prefs_dlg);
  511.   prefs_dlg = NULL;
  512.  
  513.   /*  Save variables so that we can restore them later  */
  514.   save_stingy_memory_use         = stingy_memory_use;
  515.   save_min_colors                = min_colors;
  516.   save_install_cmap              = install_cmap;
  517.   save_cycled_marching_ants      = cycled_marching_ants;
  518.   save_last_opened_size          = last_opened_size;
  519.   save_show_indicators           = show_indicators;
  520.   save_nav_window_per_display    = nav_window_per_display;
  521.   save_info_window_follows_mouse = info_window_follows_mouse;
  522.  
  523.   save_temp_path      = temp_path;
  524.   save_swap_path      = swap_path;
  525.   save_brush_path     = brush_path;
  526.   save_brush_vbr_path = brush_vbr_path;
  527.   save_pattern_path   = pattern_path;
  528.   save_palette_path   = palette_path;
  529.   save_gradient_path  = gradient_path;
  530.   save_plug_in_path   = plug_in_path;
  531.   save_module_path    = module_path;
  532.  
  533.   if (levels_of_undo != old_levels_of_undo)
  534.     {
  535.       update = g_list_append (update, "undo-levels");
  536.     }
  537.   if (marching_speed != old_marching_speed)
  538.     {
  539.       update = g_list_append (update, "marching-ants-speed");
  540.     }
  541.   if (allow_resize_windows != old_allow_resize_windows)
  542.     {
  543.       update = g_list_append (update, "allow-resize-windows");
  544.       remove = g_list_append (remove, "dont-allow-resize-windows");
  545.     }
  546.   if (auto_save != old_auto_save)
  547.     {
  548.       update = g_list_append (update, "auto-save");
  549.       remove = g_list_append (remove, "dont-auto-save");
  550.     }
  551.   if (no_cursor_updating != old_no_cursor_updating)
  552.     {
  553.       update = g_list_append (update, "cursor-updating");
  554.       remove = g_list_append (remove, "no-cursor-updating");
  555.     }
  556.   if (show_tool_tips != old_show_tool_tips)
  557.     {
  558.       update = g_list_append (update, "show-tool-tips");
  559.       remove = g_list_append (remove, "dont-show-tool-tips");
  560.     }
  561.   if (show_rulers != old_show_rulers)
  562.     {
  563.       update = g_list_append (update, "show-rulers");
  564.       remove = g_list_append (remove, "dont-show-rulers");
  565.     }
  566.   if (show_statusbar != old_show_statusbar)
  567.     {
  568.       update = g_list_append (update, "show-statusbar");
  569.       remove = g_list_append (remove, "dont-show-statusbar");
  570.     }
  571.   if (interpolation_type != old_interpolation_type)
  572.     {
  573.       update = g_list_append (update, "interpolation-type");
  574.     }
  575.   if (confirm_on_close != old_confirm_on_close)
  576.     {
  577.       update = g_list_append (update, "confirm-on-close");
  578.       remove = g_list_append (remove, "dont-confirm-on-close");
  579.     }
  580.   if (save_session_info != old_save_session_info)
  581.     {
  582.       update = g_list_append (update, "save-session-info");
  583.       remove = g_list_append (remove, "dont-save-session-info");
  584.     }
  585.   if (save_device_status!= old_save_device_status)
  586.     {
  587.       update = g_list_append (update, "save-device-status");
  588.       remove = g_list_append (remove, "dont-save-device-status");
  589.     }
  590.   if (always_restore_session != old_always_restore_session)
  591.     {
  592.       update = g_list_append (update, "always-restore-session");
  593.     }
  594.   if (default_width != old_default_width ||
  595.       default_height != old_default_height)
  596.     {
  597.       update = g_list_append (update, "default-image-size");
  598.     }
  599.   if (default_units != old_default_units)
  600.     {
  601.       update = g_list_append (update, "default-units");
  602.     }
  603.   if (ABS (default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION)
  604.     {
  605.       update = g_list_append (update, "default-xresolution");
  606.     }
  607.   if (ABS (default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION)
  608.     {
  609.       update = g_list_append (update, "default-yresolution");
  610.     }
  611.   if (default_resolution_units != old_default_resolution_units)
  612.     {
  613.       update = g_list_append (update, "default-resolution-units");
  614.     }
  615.   if (default_type != old_default_type)
  616.     {
  617.       update = g_list_append (update, "default-image-type");
  618.     }
  619.   if (prefs_strcmp (default_comment, old_default_comment))
  620.     {
  621.       update = g_list_append (update, "default-comment");
  622.     }
  623.   if (default_dot_for_dot != old_default_dot_for_dot)
  624.     {
  625.       update = g_list_append (update, "default-dot-for-dot");
  626.       remove = g_list_append (remove, "dont-default-dot-for-dot");
  627.     }
  628.   if (preview_size != old_preview_size)
  629.     {
  630.       update = g_list_append (update, "preview-size");
  631.     }
  632.   if (nav_preview_size != old_nav_preview_size)
  633.     {
  634.       update = g_list_append (update, "nav-preview-size");
  635.     }
  636.   if (perfectmouse != old_perfectmouse)
  637.     {
  638.       update = g_list_append (update, "perfect-mouse");
  639.     }
  640.   if (transparency_type != old_transparency_type)
  641.     {
  642.       update = g_list_append (update, "transparency-type");
  643.     }
  644.   if (transparency_size != old_transparency_size)
  645.     {
  646.       update = g_list_append (update, "transparency-size");
  647.     }
  648.   if (using_xserver_resolution != old_using_xserver_resolution ||
  649.       ABS(monitor_xres - old_monitor_xres) > GIMP_MIN_RESOLUTION)
  650.     {
  651.       update = g_list_append (update, "monitor-xresolution");
  652.     }
  653.   if (using_xserver_resolution != old_using_xserver_resolution ||
  654.       ABS(monitor_yres - old_monitor_yres) > GIMP_MIN_RESOLUTION)
  655.     {
  656.       update = g_list_append (update, "monitor-yresolution");
  657.     }
  658.   if (using_xserver_resolution)
  659.     {
  660.       /* special value of 0 for either x or y res in the gimprc file
  661.        * means use the xserver's current resolution */
  662.       monitor_xres = 0.0;
  663.       monitor_yres = 0.0;
  664.     }
  665.   if (prefs_strcmp (image_title_format, old_image_title_format))
  666.     {
  667.       update = g_list_append (update, "image-title-format");
  668.     }
  669.   if (global_paint_options != old_global_paint_options)
  670.     {
  671.       update = g_list_append (update, "global-paint-options");
  672.       remove = g_list_append (remove, "no-global-paint-options");
  673.     }
  674.   if (max_new_image_size != old_max_new_image_size)
  675.     {
  676.       update = g_list_append (update, "max-new-image-size");
  677.     }
  678.   if (thumbnail_mode != old_thumbnail_mode)
  679.     {
  680.       update = g_list_append (update, "thumbnail-mode");
  681.     }
  682.   if (trust_dirty_flag != old_trust_dirty_flag)
  683.     {
  684.       update = g_list_append (update, "trust-dirty-flag");
  685.       remove = g_list_append (remove, "dont-trust-dirty-flag");
  686.     }
  687.   if (use_help != old_use_help)
  688.     {
  689.       update = g_list_append (update, "use-help");
  690.       remove = g_list_append (remove, "dont-use-help");
  691.     }
  692.   if (help_browser != old_help_browser)
  693.     {
  694.       update = g_list_append (update, "help-browser");
  695.     }
  696.   if (cursor_mode != old_cursor_mode)
  697.     {
  698.       update = g_list_append (update, "cursor-mode");
  699.     }
  700.   if (default_threshold != old_default_threshold)
  701.     {
  702.       update = g_list_append (update, "default-threshold");
  703.     }
  704.   if (num_processors != old_num_processors)
  705.     {
  706.       update = g_list_append (update, "num-processors");
  707.     }
  708.  
  709.   /*  values which can't be changed on the fly  */
  710.   if (edit_stingy_memory_use != old_stingy_memory_use)
  711.     {
  712.       stingy_memory_use = edit_stingy_memory_use;
  713.       update = g_list_append (update, "stingy-memory-use");
  714.     }
  715.   if (edit_min_colors != old_min_colors)
  716.     {
  717.       min_colors = edit_min_colors;
  718.       update = g_list_append (update, "min-colors");
  719.     }
  720.   if (edit_install_cmap != old_install_cmap)
  721.     {
  722.       install_cmap = edit_install_cmap;
  723.       update = g_list_append (update, "install-colormap");
  724.     }
  725.   if (edit_cycled_marching_ants != old_cycled_marching_ants)
  726.     {
  727.       cycled_marching_ants = edit_cycled_marching_ants;
  728.       update = g_list_append (update, "colormap-cycling");
  729.     }
  730.   if (edit_last_opened_size != old_last_opened_size)
  731.     {
  732.       last_opened_size = edit_last_opened_size;
  733.       update = g_list_append (update, "last-opened-size");
  734.     }
  735.   if (edit_show_indicators != old_show_indicators)
  736.     {
  737.       show_indicators = edit_show_indicators;
  738.       update = g_list_append (update, "show-indicators");
  739.       remove = g_list_append (remove, "dont-show-indicators");
  740.     }
  741.   if (edit_nav_window_per_display != old_nav_window_per_display)
  742.     {
  743.       nav_window_per_display = edit_nav_window_per_display;
  744.       update = g_list_append (update, "nav-window-per-display");
  745.       remove = g_list_append (remove, "nav-window-follows-auto");
  746.     }
  747.   if (edit_info_window_follows_mouse != old_info_window_follows_mouse)
  748.     {
  749.       info_window_follows_mouse = edit_info_window_follows_mouse;
  750.       update = g_list_append (update, "info-window-follows-mouse");
  751.       remove = g_list_append (remove, "info-window-per-display");
  752.     }
  753.  
  754.   if (prefs_strcmp (old_temp_path, edit_temp_path))
  755.     {
  756.       temp_path = edit_temp_path;
  757.       update = g_list_append (update, "temp-path");
  758.     }
  759.   if (prefs_strcmp (old_swap_path, edit_swap_path))
  760.     {
  761.       swap_path = edit_swap_path;
  762.       update = g_list_append (update, "swap-path");
  763.     }
  764.   if (prefs_strcmp (old_brush_path, edit_brush_path))
  765.     {
  766.       brush_path = edit_brush_path;
  767.       update = g_list_append (update, "brush-path");
  768.     }
  769.   if (prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path))
  770.     {
  771.       brush_vbr_path = edit_brush_vbr_path;
  772.       update = g_list_append (update, "brush-vbr-path");
  773.     }
  774.   if (prefs_strcmp (old_pattern_path, edit_pattern_path))
  775.     {
  776.       pattern_path = edit_pattern_path;
  777.       update = g_list_append (update, "pattern-path");
  778.     }
  779.   if (prefs_strcmp (old_palette_path, edit_palette_path))
  780.     {
  781.       palette_path = edit_palette_path;
  782.       update = g_list_append (update, "palette-path");
  783.     }
  784.   if (prefs_strcmp (old_gradient_path, edit_gradient_path))
  785.     {
  786.       gradient_path = edit_gradient_path;
  787.       update = g_list_append (update, "gradient-path");
  788.     }
  789.   if (prefs_strcmp (old_plug_in_path, edit_plug_in_path))
  790.     {
  791.       plug_in_path = edit_plug_in_path;
  792.       update = g_list_append (update, "plug-in-path");
  793.     }
  794.   if (prefs_strcmp (old_module_path, edit_module_path))
  795.     {
  796.       module_path = edit_module_path;
  797.       update = g_list_append (update, "module-path");
  798.     }
  799.  
  800.   /*  values which are changed on "OK" or "Save"  */
  801.   if (edit_tile_cache_size != old_tile_cache_size)
  802.     {
  803.       tile_cache_size = edit_tile_cache_size;
  804.       update = g_list_append (update, "tile-cache-size");
  805.     }
  806.  
  807.  
  808.   save_gimprc (&update, &remove);
  809.  
  810.  
  811.   if (using_xserver_resolution)
  812.     gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
  813.  
  814.   /*  restore variables which must not change  */
  815.   stingy_memory_use         = save_stingy_memory_use;
  816.   min_colors                = save_min_colors;
  817.   install_cmap              = save_install_cmap;
  818.   cycled_marching_ants      = save_cycled_marching_ants;
  819.   last_opened_size          = save_last_opened_size;
  820.   show_indicators           = save_show_indicators;
  821.   nav_window_per_display    = save_nav_window_per_display;
  822.   info_window_follows_mouse = save_info_window_follows_mouse;
  823.  
  824.   temp_path      = save_temp_path;
  825.   swap_path      = save_swap_path;
  826.   brush_path     = save_brush_path;
  827.   brush_vbr_path = save_brush_vbr_path;
  828.   pattern_path   = save_pattern_path;
  829.   palette_path   = save_palette_path;
  830.   gradient_path  = save_gradient_path;
  831.   plug_in_path   = save_plug_in_path;
  832.   module_path    = save_module_path;
  833.  
  834.   /*  no need to restore values which are only changed on "OK" and "Save"  */
  835.  
  836.   g_list_free (update);
  837.   g_list_free (remove);
  838. }
  839.  
  840. static void
  841. prefs_cancel_callback (GtkWidget *widget,
  842.                 GtkWidget *dlg)
  843. {
  844.   gtk_widget_destroy (dlg);
  845.   prefs_dlg = NULL;
  846.  
  847.   /*  restore ordinary gimprc variables  */
  848.   levels_of_undo           = old_levels_of_undo;
  849.   marching_speed           = old_marching_speed;
  850.   allow_resize_windows     = old_allow_resize_windows;
  851.   auto_save                = old_auto_save;
  852.   no_cursor_updating       = old_no_cursor_updating;
  853.   perfectmouse             = old_perfectmouse;
  854.   show_tool_tips           = old_show_tool_tips;
  855.   show_rulers              = old_show_rulers;
  856.   show_statusbar           = old_show_statusbar;
  857.   interpolation_type       = old_interpolation_type;
  858.   confirm_on_close         = old_confirm_on_close;
  859.   save_session_info        = old_save_session_info;
  860.   save_device_status       = old_save_device_status;
  861.   default_width            = old_default_width;
  862.   default_height           = old_default_height;
  863.   default_units            = old_default_units;
  864.   default_xresolution      = old_default_xresolution;
  865.   default_yresolution      = old_default_yresolution;
  866.   default_resolution_units = old_default_resolution_units;
  867.   default_type             = old_default_type;
  868.   default_dot_for_dot      = old_default_dot_for_dot;
  869.   monitor_xres             = old_monitor_xres;
  870.   monitor_yres             = old_monitor_yres;
  871.   using_xserver_resolution = old_using_xserver_resolution;
  872.   max_new_image_size       = old_max_new_image_size;
  873.   thumbnail_mode           = old_thumbnail_mode;
  874.   trust_dirty_flag         = old_trust_dirty_flag;
  875.   use_help                 = old_use_help;
  876.   help_browser             = old_help_browser;
  877.   cursor_mode              = old_cursor_mode;
  878.   default_threshold        = old_default_threshold;
  879.   num_processors           = old_num_processors;
  880.  
  881.   /*  restore variables which need some magic  */
  882.   if (preview_size != old_preview_size)
  883.     {
  884.       lc_dialog_rebuild (old_preview_size);
  885.       layer_select_update_preview_size ();
  886.     }
  887.   if (nav_preview_size != old_nav_preview_size)
  888.     {
  889.       nav_preview_size = old_nav_preview_size;
  890.       gdisplays_nav_preview_resized ();
  891.     }
  892.   if ((transparency_type != old_transparency_type) ||
  893.       (transparency_size != old_transparency_size))
  894.     {
  895.       transparency_type = old_transparency_type;
  896.       transparency_size = old_transparency_size;
  897.  
  898.       render_setup (transparency_type, transparency_size);
  899.       gimage_foreach ((GFunc)layer_invalidate_previews, NULL);
  900.       gimage_invalidate_previews ();
  901.       gdisplays_expose_full ();
  902.       gdisplays_flush ();
  903.     }
  904.  
  905.   prefs_strset (&image_title_format, old_image_title_format);
  906.   prefs_strset (&default_comment, old_default_comment);
  907.  
  908.   context_manager_set_global_paint_options (old_global_paint_options);
  909.  
  910.   /*  restore values which need a restart  */
  911.   edit_stingy_memory_use         = old_stingy_memory_use;
  912.   edit_min_colors                = old_min_colors;
  913.   edit_install_cmap              = old_install_cmap;
  914.   edit_cycled_marching_ants      = old_cycled_marching_ants;
  915.   edit_last_opened_size          = old_last_opened_size;
  916.   edit_show_indicators           = old_show_indicators;
  917.   edit_nav_window_per_display    = old_nav_window_per_display;
  918.   edit_info_window_follows_mouse = old_info_window_follows_mouse;
  919.  
  920.   prefs_strset (&edit_temp_path,      old_temp_path);
  921.   prefs_strset (&edit_swap_path,      old_swap_path);
  922.   prefs_strset (&edit_brush_path,     old_brush_path);
  923.   prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
  924.   prefs_strset (&edit_pattern_path,   old_pattern_path);
  925.   prefs_strset (&edit_palette_path,   old_palette_path);
  926.   prefs_strset (&edit_gradient_path,  old_gradient_path);
  927.   prefs_strset (&edit_plug_in_path,   old_plug_in_path);
  928.   prefs_strset (&edit_module_path,    old_module_path);
  929.  
  930.   /*  no need to restore values which are only changed on "OK" and "Save"  */
  931. }
  932.  
  933. static void
  934. prefs_toggle_callback (GtkWidget *widget,
  935.                 gpointer   data)
  936. {
  937.   gint *val;
  938.  
  939.   val = (gint *) data;
  940.  
  941.   /*  toggle buttos  */
  942.   if (data == &allow_resize_windows   ||
  943.       data == &auto_save              ||
  944.       data == &no_cursor_updating     ||
  945.       data == &perfectmouse           ||
  946.       data == &show_tool_tips         ||
  947.       data == &show_rulers            ||
  948.       data == &show_statusbar         ||
  949.       data == &confirm_on_close       ||
  950.       data == &save_session_info      ||
  951.       data == &save_device_status     ||
  952.       data == &always_restore_session ||
  953.       data == &default_dot_for_dot    ||
  954.       data == &use_help               ||
  955.  
  956.       data == &edit_stingy_memory_use         ||
  957.       data == &edit_install_cmap              ||
  958.       data == &edit_cycled_marching_ants      ||
  959.       data == &edit_show_indicators           ||
  960.       data == &edit_nav_window_per_display    ||
  961.       data == &edit_info_window_follows_mouse)
  962.     {
  963.       *val = GTK_TOGGLE_BUTTON (widget)->active;
  964.     }
  965.  
  966.   /*  radio buttons  */
  967.   else if (data == &thumbnail_mode     ||
  968.        data == &interpolation_type ||
  969.            data == &trust_dirty_flag   ||
  970.        data == &help_browser       ||
  971.        data == &cursor_mode        ||
  972.        data == &default_type)
  973.     {
  974.       *val = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
  975.     }
  976.  
  977.   /*  values which need some magic  */
  978.   else if ((data == &transparency_type) ||
  979.        (data == &transparency_size))
  980.     {
  981.       *val = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
  982.  
  983.       render_setup (transparency_type, transparency_size);
  984.       gimage_foreach ((GFunc) layer_invalidate_previews, NULL);
  985.       gimage_invalidate_previews ();
  986.       gdisplays_expose_full ();
  987.       gdisplays_flush ();
  988.     }
  989.   else if (data == &global_paint_options)
  990.     {
  991.       context_manager_set_global_paint_options
  992.     (GTK_TOGGLE_BUTTON (widget)->active);
  993.     }
  994.  
  995.   /*  no matching varible found  */
  996.   else
  997.     {
  998.       /*  Are you a gimp-hacker who is getting this message?  You
  999.        *  probably have to set your preferences value in one of the
  1000.        *  branches above...
  1001.        */
  1002.       g_warning ("Unknown prefs_toggle_callback() invoker - ignored.");
  1003.     }
  1004. }
  1005.  
  1006. static void
  1007. prefs_preview_size_callback (GtkWidget *widget,
  1008.                                   gpointer   data)
  1009. {
  1010.   lc_dialog_rebuild ((long) gtk_object_get_user_data (GTK_OBJECT (widget)));
  1011.   layer_select_update_preview_size ();
  1012. }
  1013.  
  1014. static void
  1015. prefs_nav_preview_size_callback (GtkWidget *widget,
  1016.                       gpointer   data)
  1017. {
  1018.   nav_preview_size = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
  1019.   gdisplays_nav_preview_resized ();
  1020. }
  1021.  
  1022. static void
  1023. prefs_string_callback (GtkWidget *widget,
  1024.                 gpointer   data)
  1025. {
  1026.   gchar **val;
  1027.  
  1028.   val = data;
  1029.   prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
  1030. }
  1031.  
  1032. static void
  1033. prefs_text_callback (GtkWidget *widget,
  1034.               gpointer   data)
  1035. {
  1036.   gchar **val;
  1037.   gchar *text;
  1038.   
  1039.   val = data;
  1040.  
  1041.   text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
  1042.   if (strlen (text) > MAX_COMMENT_LENGTH)
  1043.     {
  1044.       g_message (_("The default comment is limited to %d characters."), 
  1045.          MAX_COMMENT_LENGTH);
  1046.       gtk_editable_delete_text (GTK_EDITABLE (widget), MAX_COMMENT_LENGTH, -1);
  1047.       g_free (text);
  1048.     }
  1049.   else
  1050.     prefs_strset (val, text);
  1051. }
  1052.  
  1053. static void
  1054. prefs_filename_callback (GtkWidget *widget,
  1055.                   gpointer   data)
  1056. {
  1057.   gchar **val;
  1058.   gchar *filename;
  1059.  
  1060.   val = data;
  1061.   filename = gimp_file_selection_get_filename (GIMP_FILE_SELECTION (widget));
  1062.   prefs_strset (val, filename);
  1063.   g_free (filename);
  1064. }
  1065.  
  1066. static void
  1067. prefs_path_callback (GtkWidget *widget,
  1068.               gpointer   data)
  1069. {
  1070.   gchar **val;
  1071.   gchar  *path;
  1072.  
  1073.   val  = (gchar **) data;
  1074.   path = gimp_path_editor_get_path (GIMP_PATH_EDITOR (widget));
  1075.   prefs_strset (val, path);
  1076.   g_free (path);
  1077. }
  1078.  
  1079. static void
  1080. prefs_clear_session_info_callback (GtkWidget *widget,
  1081.                     gpointer   data)
  1082. {
  1083.   g_list_free (session_info_updates);
  1084.   session_info_updates = NULL;
  1085. }
  1086.  
  1087. static void
  1088. prefs_default_size_callback (GtkWidget *widget,
  1089.                   gpointer   data)
  1090. {
  1091.   default_width =
  1092.     RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0));
  1093.   default_height =
  1094.     RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1));
  1095.   default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
  1096. }
  1097.  
  1098. static void
  1099. prefs_default_resolution_callback (GtkWidget *widget,
  1100.                     gpointer   data)
  1101. {
  1102.   GtkWidget *size_sizeentry;
  1103.   static gdouble xres = 0.0;
  1104.   static gdouble yres = 0.0;
  1105.   gdouble new_xres;
  1106.   gdouble new_yres;
  1107.  
  1108.   new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
  1109.   new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
  1110.  
  1111.   size_sizeentry = gtk_object_get_data (GTK_OBJECT (widget), "size_sizeentry");
  1112.  
  1113.   if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
  1114.     {
  1115.       if (new_xres != xres)
  1116.     {
  1117.       yres = new_yres = xres = new_xres;
  1118.       gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, yres);
  1119.     }
  1120.  
  1121.       if (new_yres != yres)
  1122.     {
  1123.       xres = new_xres = yres = new_yres;
  1124.       gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, xres);
  1125.     }
  1126.     }
  1127.   else
  1128.     {
  1129.       if (new_xres != xres)
  1130.     xres = new_xres;
  1131.       if (new_yres != yres)
  1132.     yres = new_yres;
  1133.     }
  1134.  
  1135.   gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
  1136.                   0, xres, FALSE);
  1137.   gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry),
  1138.                   1, yres, FALSE);
  1139.  
  1140.   default_width =
  1141.     RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 0));
  1142.   default_height =
  1143.     RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (size_sizeentry), 1));
  1144.  
  1145.   default_xresolution = xres;
  1146.   default_yresolution = yres;
  1147.  
  1148.   default_resolution_units = 
  1149.     gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
  1150. }
  1151.  
  1152. static void
  1153. prefs_res_source_callback (GtkWidget *widget,
  1154.                 gpointer   data)
  1155. {
  1156.   GtkWidget *monitor_resolution_sizeentry;
  1157.  
  1158.   gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
  1159.  
  1160.   if (GTK_TOGGLE_BUTTON (widget)->active)
  1161.     {
  1162.       gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
  1163.       using_xserver_resolution = TRUE;
  1164.     }
  1165.   else
  1166.     {
  1167.       monitor_resolution_sizeentry =
  1168.     gtk_object_get_data (GTK_OBJECT (widget), "monitor_resolution_sizeentry");
  1169.  
  1170.       if (monitor_resolution_sizeentry)
  1171.     {
  1172.       monitor_xres = gimp_size_entry_get_refval
  1173.         (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
  1174.       monitor_yres = gimp_size_entry_get_refval
  1175.         (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
  1176.     }
  1177.       using_xserver_resolution = FALSE;
  1178.     }
  1179. }
  1180.  
  1181. static void
  1182. prefs_monitor_resolution_callback (GtkWidget *widget,
  1183.                     gpointer   data)
  1184. {
  1185.   static gdouble xres = 0.0;
  1186.   static gdouble yres = 0.0;
  1187.   gdouble new_xres;
  1188.   gdouble new_yres;
  1189.  
  1190.   new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
  1191.   new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
  1192.  
  1193.   if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
  1194.     {
  1195.       if (new_xres != xres)
  1196.     {
  1197.       yres = new_yres = xres = new_xres;
  1198.       gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, yres);
  1199.     }
  1200.  
  1201.       if (new_yres != yres)
  1202.     {
  1203.       xres = new_xres = yres = new_yres;
  1204.       gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, xres);
  1205.     }
  1206.     }
  1207.   else
  1208.     {
  1209.       if (new_xres != xres)
  1210.     xres = new_xres;
  1211.       if (new_yres != yres)
  1212.     yres = new_yres;
  1213.     }
  1214.  
  1215.   monitor_xres = xres;
  1216.   monitor_yres = yres;
  1217. }
  1218.  
  1219. static void
  1220. prefs_resolution_calibrate_callback (GtkWidget *widget,
  1221.                      gpointer   data)
  1222. {
  1223.   resolution_calibrate_dialog (GTK_WIDGET (data), NULL, NULL, NULL);
  1224. }
  1225.  
  1226. /*  create a new notebook page  */
  1227. static GtkWidget *
  1228. prefs_notebook_append_page (GtkNotebook   *notebook,
  1229.                  gchar         *notebook_label,
  1230.                  GtkCTree      *ctree,
  1231.                  gchar         *tree_label,
  1232.                  gchar         *help_data,
  1233.                  GtkCTreeNode  *parent,
  1234.                  GtkCTreeNode **new_node,
  1235.                  gint           page_index)
  1236. {
  1237.   GtkWidget *event_box;
  1238.   GtkWidget *out_vbox;
  1239.   GtkWidget *vbox;
  1240.   GtkWidget *frame;
  1241.   GtkWidget *label;
  1242.   gchar     *titles[1];
  1243.  
  1244.   event_box = gtk_event_box_new ();
  1245.   gtk_widget_show (event_box);
  1246.  
  1247.   gimp_help_set_help_data (event_box, NULL, help_data);
  1248.  
  1249.   out_vbox = gtk_vbox_new (FALSE, 0);
  1250.   gtk_container_add (GTK_CONTAINER (event_box), out_vbox);
  1251.   gtk_widget_show (out_vbox);
  1252.  
  1253.   frame = gtk_frame_new (NULL);
  1254.   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
  1255.   gtk_box_pack_start (GTK_BOX (out_vbox), frame, FALSE, TRUE, 0);
  1256.   gtk_widget_show (frame);
  1257.  
  1258.   label = gtk_label_new (notebook_label);
  1259.   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
  1260.   gtk_misc_set_padding (GTK_MISC (label), 2, 1);
  1261.   gtk_container_add (GTK_CONTAINER (frame), label);
  1262.   gtk_widget_show (label);
  1263.  
  1264.   vbox = gtk_vbox_new (FALSE, 2);
  1265.   gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
  1266.   gtk_container_add (GTK_CONTAINER (out_vbox), vbox);
  1267.   gtk_widget_show (vbox);
  1268.  
  1269.   titles[0] = tree_label;
  1270.   *new_node = gtk_ctree_insert_node (ctree, parent, NULL,
  1271.                      titles, 0,
  1272.                      NULL, NULL, NULL, NULL,
  1273.                      FALSE, TRUE);
  1274.   gtk_ctree_node_set_row_data (ctree, *new_node, GINT_TO_POINTER (page_index));
  1275.   gtk_notebook_append_page (notebook, event_box, NULL);
  1276.  
  1277.   return vbox;
  1278. }
  1279.  
  1280. /*  select a notebook page  */
  1281. static void
  1282. prefs_tree_select_callback (GtkWidget    *widget,
  1283.                 GtkCTreeNode *node)
  1284. {
  1285.   GtkNotebook *notebook;
  1286.   gint         page;
  1287.  
  1288.   if (! GTK_CLIST (widget)->selection)
  1289.     return;
  1290.  
  1291.   notebook = (GtkNotebook*) gtk_object_get_user_data (GTK_OBJECT (widget));
  1292.   page = GPOINTER_TO_INT (gtk_ctree_node_get_row_data (GTK_CTREE (widget), node));
  1293.  
  1294.   gtk_notebook_set_page (notebook, page);
  1295. }
  1296.  
  1297. /*  create a frame with title and a vbox  */
  1298. static GtkWidget *
  1299. prefs_frame_new (gchar  *label,
  1300.               GtkBox *vbox)
  1301. {
  1302.   GtkWidget *frame;
  1303.   GtkWidget *vbox2;
  1304.  
  1305.   frame = gtk_frame_new (label);
  1306.   gtk_box_pack_start (vbox, frame, FALSE, FALSE, 0);
  1307.   gtk_widget_show (frame);
  1308.  
  1309.   vbox2 = gtk_vbox_new (FALSE, 2);
  1310.   gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
  1311.   gtk_container_add (GTK_CONTAINER (frame), vbox2);
  1312.   gtk_widget_show (vbox2);
  1313.  
  1314.   return vbox2;
  1315. }
  1316.  
  1317. static void
  1318. prefs_help_func (const gchar *help_data)
  1319. {
  1320.   GtkWidget *notebook;
  1321.   GtkWidget *event_box;
  1322.   gint page_num;
  1323.  
  1324.   notebook = gtk_object_get_user_data (GTK_OBJECT (prefs_dlg));
  1325.   page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
  1326.   event_box = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num);
  1327.  
  1328.   help_data = gtk_object_get_data (GTK_OBJECT (event_box), "gimp_help_data");
  1329.   gimp_standard_help_func (help_data);
  1330. }
  1331.  
  1332. /************************************************************************
  1333.  *  create the preferences dialog
  1334.  */
  1335. void
  1336. prefs_cmd_callback (GtkWidget *widget,
  1337.             gpointer   client_data)
  1338. {
  1339.   GtkWidget    *ctree;
  1340.   gchar        *titles[1];
  1341.   GtkCTreeNode *top_insert;
  1342.   GtkCTreeNode *child_insert;
  1343.   gint          page_index;
  1344.  
  1345.   GtkWidget *frame;
  1346.   GtkWidget *notebook;
  1347.   GtkWidget *vbox;
  1348.   GtkWidget *vbox2;
  1349.   GtkWidget *hbox;
  1350.   GtkWidget *abox;
  1351.   GtkWidget *button;
  1352.   GtkWidget *fileselection;
  1353.   GtkWidget *patheditor;
  1354.   GtkWidget *spinbutton;
  1355.   GtkWidget *combo;
  1356.   GtkWidget *comboitem;
  1357.   GtkWidget *optionmenu;
  1358.   GtkWidget *table;
  1359.   GtkWidget *label;
  1360.   GtkObject *adjustment;
  1361.   GtkWidget *sizeentry;
  1362.   GtkWidget *sizeentry2;
  1363.   GtkWidget *separator;
  1364.   GtkWidget *calibrate_button;
  1365.   GtkWidget *text;
  1366.   GSList    *group;
  1367.  
  1368.   gint i;
  1369.   gchar *pixels_per_unit;
  1370.  
  1371.   if (prefs_dlg)
  1372.     {
  1373.       gdk_window_raise (GTK_WIDGET (prefs_dlg)->window);
  1374.       return;
  1375.     }
  1376.  
  1377.   if (edit_temp_path == NULL)
  1378.     {
  1379.       /*  first time dialog is opened -
  1380.        *  copy config vals to edit variables.
  1381.        */
  1382.       edit_stingy_memory_use         = stingy_memory_use;
  1383.       edit_min_colors                = min_colors;
  1384.       edit_install_cmap              = install_cmap;
  1385.       edit_cycled_marching_ants      = cycled_marching_ants;
  1386.       edit_last_opened_size          = last_opened_size;
  1387.       edit_show_indicators           = show_indicators;
  1388.       edit_nav_window_per_display    = nav_window_per_display;
  1389.       edit_info_window_follows_mouse = info_window_follows_mouse;
  1390.  
  1391.       edit_temp_path      = prefs_strdup (temp_path);    
  1392.       edit_swap_path      = prefs_strdup (swap_path);
  1393.       edit_plug_in_path   = prefs_strdup (plug_in_path);
  1394.       edit_module_path    = prefs_strdup (module_path);
  1395.       edit_brush_path     = prefs_strdup (brush_path);
  1396.       edit_brush_vbr_path = prefs_strdup (brush_vbr_path);
  1397.       edit_pattern_path   = prefs_strdup (pattern_path);
  1398.       edit_palette_path   = prefs_strdup (palette_path);
  1399.       edit_gradient_path  = prefs_strdup (gradient_path);
  1400.     }
  1401.  
  1402.   /*  assign edit variables for values which get changed on "OK" and "Save"
  1403.    *  but not on the fly.
  1404.    */
  1405.   edit_tile_cache_size = tile_cache_size;
  1406.  
  1407.   /*  remember all old values  */
  1408.   old_perfectmouse             = perfectmouse;
  1409.   old_transparency_type        = transparency_type;
  1410.   old_transparency_size        = transparency_size;
  1411.   old_levels_of_undo           = levels_of_undo;
  1412.   old_marching_speed           = marching_speed;
  1413.   old_allow_resize_windows     = allow_resize_windows;
  1414.   old_auto_save                = auto_save;
  1415.   old_preview_size             = preview_size;
  1416.   old_nav_preview_size         = nav_preview_size;
  1417.   old_no_cursor_updating       = no_cursor_updating;
  1418.   old_show_tool_tips           = show_tool_tips;
  1419.   old_show_rulers              = show_rulers;
  1420.   old_show_statusbar           = show_statusbar;
  1421.   old_interpolation_type       = interpolation_type;
  1422.   old_confirm_on_close         = confirm_on_close;
  1423.   old_save_session_info        = save_session_info;
  1424.   old_save_device_status       = save_device_status;
  1425.   old_always_restore_session   = always_restore_session;
  1426.   old_default_width            = default_width;
  1427.   old_default_height           = default_height;
  1428.   old_default_units            = default_units;
  1429.   old_default_xresolution      = default_xresolution;
  1430.   old_default_yresolution      = default_yresolution;
  1431.   old_default_resolution_units = default_resolution_units;
  1432.   old_default_type             = default_type;
  1433.   old_default_dot_for_dot      = default_dot_for_dot;
  1434.   old_monitor_xres             = monitor_xres;
  1435.   old_monitor_yres             = monitor_yres;
  1436.   old_using_xserver_resolution = using_xserver_resolution;
  1437.   old_global_paint_options     = global_paint_options;
  1438.   old_max_new_image_size       = max_new_image_size;
  1439.   old_thumbnail_mode           = thumbnail_mode;
  1440.   old_trust_dirty_flag         = trust_dirty_flag;
  1441.   old_use_help                 = use_help;
  1442.   old_help_browser             = help_browser;
  1443.   old_cursor_mode              = cursor_mode;
  1444.   old_default_threshold        = default_threshold;
  1445.   old_num_processors           = num_processors;
  1446.  
  1447.   prefs_strset (&old_image_title_format, image_title_format);    
  1448.   prefs_strset (&old_default_comment, default_comment);    
  1449.  
  1450.   /*  values which will need a restart  */
  1451.   old_stingy_memory_use         = edit_stingy_memory_use;
  1452.   old_min_colors                = edit_min_colors;
  1453.   old_install_cmap              = edit_install_cmap;
  1454.   old_cycled_marching_ants      = edit_cycled_marching_ants;
  1455.   old_last_opened_size          = edit_last_opened_size;
  1456.   old_show_indicators           = edit_show_indicators;
  1457.   old_nav_window_per_display    = edit_nav_window_per_display;
  1458.   old_info_window_follows_mouse = edit_info_window_follows_mouse;
  1459.  
  1460.   prefs_strset (&old_temp_path,      edit_temp_path);
  1461.   prefs_strset (&old_swap_path,      edit_swap_path);
  1462.   prefs_strset (&old_plug_in_path,   edit_plug_in_path);
  1463.   prefs_strset (&old_module_path,    edit_module_path);
  1464.   prefs_strset (&old_brush_path,     edit_brush_path);
  1465.   prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
  1466.   prefs_strset (&old_pattern_path,   edit_pattern_path);
  1467.   prefs_strset (&old_palette_path,   edit_palette_path);
  1468.   prefs_strset (&old_gradient_path,  edit_gradient_path);
  1469.  
  1470.   /*  values which will be changed on "OK" and "Save"  */
  1471.   old_tile_cache_size = edit_tile_cache_size;
  1472.  
  1473.   /* Create the dialog */
  1474.   prefs_dlg =
  1475.     gimp_dialog_new (_("Preferences"), "gimp_preferences",
  1476.              prefs_help_func,
  1477.              "dialogs/preferences/preferences.html",
  1478.              GTK_WIN_POS_NONE,
  1479.              FALSE, TRUE, FALSE,
  1480.  
  1481.              _("OK"), prefs_ok_callback,
  1482.              NULL, NULL, NULL, FALSE, FALSE,
  1483.              _("Save"), prefs_save_callback,
  1484.              NULL, NULL, NULL, FALSE, FALSE,
  1485.              _("Cancel"), prefs_cancel_callback,
  1486.              NULL, NULL, NULL, TRUE, TRUE,
  1487.  
  1488.              NULL);
  1489.  
  1490.   /* The main hbox */
  1491.   hbox = gtk_hbox_new (FALSE, 6);
  1492.   gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
  1493.   gtk_container_add (GTK_CONTAINER (GTK_DIALOG (prefs_dlg)->vbox), hbox);
  1494.   gtk_widget_show (hbox);
  1495.  
  1496.   /* The categories tree */
  1497.   titles[0] = _("Categories");
  1498.   ctree = gtk_ctree_new_with_titles (1, 0, titles);
  1499.   gtk_ctree_set_indent (GTK_CTREE (ctree), 15);
  1500.   gtk_clist_column_titles_passive (GTK_CLIST (ctree));
  1501.   gtk_box_pack_start (GTK_BOX (hbox), ctree, FALSE, FALSE, 0);
  1502.  
  1503.   /* The main preferences notebook */
  1504.   frame = gtk_frame_new (NULL);
  1505.   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  1506.   gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
  1507.   gtk_widget_show (frame);
  1508.  
  1509.   notebook = gtk_notebook_new ();
  1510.   gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
  1511.   gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
  1512.   gtk_container_add (GTK_CONTAINER (frame), notebook);
  1513.  
  1514.   gtk_object_set_user_data (GTK_OBJECT (prefs_dlg), notebook);
  1515.   gtk_object_set_user_data (GTK_OBJECT (ctree), notebook);
  1516.  
  1517.   gtk_signal_connect (GTK_OBJECT (ctree), "tree_select_row",
  1518.               GTK_SIGNAL_FUNC (prefs_tree_select_callback),
  1519.               NULL);
  1520.  
  1521.   page_index = 0;
  1522.  
  1523.   /* New File page */
  1524.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  1525.                       _("New File"),
  1526.                       GTK_CTREE (ctree),
  1527.                       _("New File"),
  1528.                       "dialogs/preferences/new_file.html",
  1529.                       NULL,
  1530.                       &top_insert,
  1531.                       page_index);
  1532.   gtk_widget_show (vbox);
  1533.   page_index++;
  1534.  
  1535.   /* select this page in the tree */
  1536.   gtk_ctree_select (GTK_CTREE (ctree), top_insert);
  1537.  
  1538.   frame = gtk_frame_new (_("Default Image Size and Unit")); 
  1539.   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  1540.   gtk_widget_show (frame);
  1541.  
  1542.   hbox = gtk_hbox_new (FALSE, 0);
  1543.   gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
  1544.   gtk_container_add (GTK_CONTAINER (frame), hbox);
  1545.   gtk_widget_show (hbox);
  1546.  
  1547.   sizeentry =
  1548.     gimp_size_entry_new (2, default_units, "%p", FALSE, FALSE, TRUE, 75,
  1549.              GIMP_SIZE_ENTRY_UPDATE_SIZE);
  1550.  
  1551.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
  1552.                 _("Width"), 0, 1, 0.0);
  1553.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
  1554.                 _("Height"), 0, 2, 0.0);
  1555.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
  1556.                 _("Pixels"), 1, 4, 0.0);
  1557.  
  1558.   gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
  1559.                   0, default_xresolution, FALSE);
  1560.   gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry),
  1561.                   1, default_yresolution, FALSE);
  1562.  
  1563.   gimp_size_entry_set_refval_boundaries
  1564.     (GIMP_SIZE_ENTRY (sizeentry), 0, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
  1565.   gimp_size_entry_set_refval_boundaries
  1566.     (GIMP_SIZE_ENTRY (sizeentry), 1, GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
  1567.  
  1568.   gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, default_width);
  1569.   gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, default_height);
  1570.  
  1571.   gtk_signal_connect (GTK_OBJECT (sizeentry), "unit_changed",
  1572.               GTK_SIGNAL_FUNC (prefs_default_size_callback),
  1573.               NULL);
  1574.   gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
  1575.               GTK_SIGNAL_FUNC (prefs_default_size_callback),
  1576.               NULL);
  1577.   gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
  1578.               GTK_SIGNAL_FUNC (prefs_default_size_callback),
  1579.               NULL);
  1580.  
  1581.   gtk_box_pack_start (GTK_BOX (hbox), sizeentry, FALSE, FALSE, 0);
  1582.   gtk_widget_show (sizeentry);
  1583.  
  1584.   frame = gtk_frame_new (_("Default Image Resolution and Resolution Unit"));
  1585.   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  1586.   gtk_widget_show (frame);
  1587.  
  1588.   hbox = gtk_hbox_new (FALSE, 0);
  1589.   gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
  1590.   gtk_container_add (GTK_CONTAINER (frame), hbox);
  1591.   gtk_widget_show (hbox);
  1592.  
  1593.   pixels_per_unit = g_strconcat (_("Pixels"), "/%s", NULL);
  1594.  
  1595.   sizeentry2 =
  1596.     gimp_size_entry_new (2, default_resolution_units, pixels_per_unit,
  1597.              FALSE, FALSE, TRUE, 75,
  1598.              GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
  1599.  
  1600.   button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
  1601.   if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
  1602.     gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
  1603.   gtk_table_attach_defaults (GTK_TABLE (sizeentry2), button, 1, 3, 3, 4);
  1604.   gtk_widget_show (button);
  1605.  
  1606.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
  1607.                 _("Horizontal"), 0, 1, 0.0);
  1608.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
  1609.                 _("Vertical"), 0, 2, 0.0);
  1610.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry2),
  1611.                 _("dpi"), 1, 4, 0.0);
  1612.  
  1613.   gtk_object_set_data (GTK_OBJECT (sizeentry2), "size_sizeentry", sizeentry);
  1614.  
  1615.   gimp_size_entry_set_refval_boundaries
  1616.     (GIMP_SIZE_ENTRY (sizeentry2), 0, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
  1617.   gimp_size_entry_set_refval_boundaries
  1618.     (GIMP_SIZE_ENTRY (sizeentry2), 1, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
  1619.  
  1620.   gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
  1621.                   0, default_xresolution);
  1622.   gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry2),
  1623.                   1, default_yresolution);
  1624.  
  1625.   gtk_signal_connect (GTK_OBJECT (sizeentry2), "unit_changed",
  1626.               (GtkSignalFunc) prefs_default_resolution_callback,
  1627.               button);
  1628.   gtk_signal_connect (GTK_OBJECT (sizeentry2), "value_changed",
  1629.               (GtkSignalFunc) prefs_default_resolution_callback,
  1630.               button);
  1631.   gtk_signal_connect (GTK_OBJECT (sizeentry2), "refval_changed",
  1632.               (GtkSignalFunc) prefs_default_resolution_callback,
  1633.               button);
  1634.  
  1635.   gtk_box_pack_start (GTK_BOX (hbox), sizeentry2, FALSE, FALSE, 0);
  1636.   gtk_widget_show (sizeentry2);
  1637.  
  1638.   hbox = gtk_hbox_new (FALSE, 2);
  1639.   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  1640.   gtk_widget_show (hbox);
  1641.       
  1642.   table = gtk_table_new (2, 2, FALSE);
  1643.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  1644.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  1645.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  1646.   gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
  1647.   gtk_widget_show (table);
  1648.  
  1649.   optionmenu =
  1650.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  1651.                &default_type, GINT_TO_POINTER (default_type),
  1652.  
  1653.                _("RGB"),       GINT_TO_POINTER (RGB), NULL,
  1654.                _("Grayscale"), GINT_TO_POINTER (GRAY), NULL,
  1655.  
  1656.                NULL);
  1657.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  1658.                  _("Default Image Type:"), 1.0, 0.5,
  1659.                  optionmenu, 1, TRUE);
  1660.  
  1661.   /*  The maximum size of a new image  */  
  1662.   adjustment = gtk_adjustment_new (max_new_image_size, 
  1663.                    0, (4069.0 * 1024 * 1024 - 1), 
  1664.                    1.0, 1.0, 0.0);
  1665.   hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
  1666.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  1667.               GTK_SIGNAL_FUNC (gimp_uint_adjustment_update),
  1668.               &max_new_image_size);
  1669.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
  1670.                  _("Maximum Image Size:"), 1.0, 0.5,
  1671.                  hbox, 1, TRUE);
  1672.  
  1673.   /* Default Comment page */
  1674.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  1675.                       _("Default Comment"),
  1676.                       GTK_CTREE (ctree),
  1677.                       _("Default Comment"),
  1678.                       "dialogs/preferences/new_file.html#default_comment",
  1679.                       top_insert,
  1680.                       &child_insert,
  1681.                       page_index);
  1682.   gtk_widget_show (vbox);
  1683.   page_index++;
  1684.  
  1685.   frame = gtk_frame_new (_("Comment Used for New Images"));
  1686.   gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
  1687.   gtk_widget_show (frame);
  1688.  
  1689.   hbox = gtk_hbox_new (FALSE, 0);
  1690.   gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
  1691.   gtk_container_add (GTK_CONTAINER (frame), hbox);
  1692.   gtk_widget_show (hbox);
  1693.  
  1694.   text = gtk_text_new (NULL, NULL);
  1695.   gtk_text_set_editable (GTK_TEXT (text), TRUE);
  1696.   gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, default_comment, -1);
  1697.   gtk_signal_connect (GTK_OBJECT (text), "changed",
  1698.               GTK_SIGNAL_FUNC (prefs_text_callback),
  1699.               &default_comment);
  1700.   gtk_container_add (GTK_CONTAINER (hbox), text);
  1701.   gtk_widget_show (text);
  1702.  
  1703.   /* Display page */
  1704.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  1705.                       _("Display"),
  1706.                       GTK_CTREE (ctree),
  1707.                       _("Display"),
  1708.                       "dialogs/preferences/display.html",
  1709.                       NULL,
  1710.                       &top_insert,
  1711.                       page_index);
  1712.   gtk_widget_show (vbox);
  1713.   page_index++;
  1714.  
  1715.   frame = gtk_frame_new (_("Transparency")); 
  1716.   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  1717.   gtk_widget_show (frame);
  1718.  
  1719.   hbox = gtk_hbox_new (FALSE, 2);
  1720.   gtk_container_add (GTK_CONTAINER (frame), hbox);
  1721.   gtk_widget_show (hbox);
  1722.  
  1723.   table = gtk_table_new (2, 2, FALSE);
  1724.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  1725.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  1726.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  1727.   gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
  1728.   gtk_widget_show (table);
  1729.  
  1730.   optionmenu =
  1731.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  1732.                &transparency_type, GINT_TO_POINTER (transparency_type),
  1733.  
  1734.                _("Light Checks"),    GINT_TO_POINTER (LIGHT_CHECKS), NULL,
  1735.                _("Mid-Tone Checks"), GINT_TO_POINTER (GRAY_CHECKS), NULL,
  1736.                _("Dark Checks"),     GINT_TO_POINTER (DARK_CHECKS), NULL,
  1737.                _("White Only"),      GINT_TO_POINTER (WHITE_ONLY), NULL,
  1738.                _("Gray Only"),       GINT_TO_POINTER (GRAY_ONLY), NULL,
  1739.                _("Black Only"),      GINT_TO_POINTER (BLACK_ONLY), NULL,
  1740.  
  1741.                NULL);
  1742.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  1743.                  _("Transparency Type:"), 1.0, 0.5,
  1744.                  optionmenu, 1, TRUE);
  1745.  
  1746.   optionmenu =
  1747.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  1748.                &transparency_size, GINT_TO_POINTER (transparency_size),
  1749.  
  1750.                _("Small"),  GINT_TO_POINTER (SMALL_CHECKS), NULL,
  1751.                _("Medium"), GINT_TO_POINTER (MEDIUM_CHECKS), NULL,
  1752.                _("Large"),  GINT_TO_POINTER (LARGE_CHECKS), NULL,
  1753.  
  1754.                NULL);
  1755.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
  1756.                  _("Check Size:"), 1.0, 0.5,
  1757.                  optionmenu, 1, TRUE);
  1758.  
  1759.   vbox2 = prefs_frame_new (_("8-Bit Displays"), GTK_BOX (vbox));
  1760.  
  1761.   if (g_visual->depth != 8)
  1762.     gtk_widget_set_sensitive (GTK_WIDGET (vbox2->parent), FALSE);
  1763.  
  1764.   table = gtk_table_new (1, 2, FALSE);
  1765.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  1766.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  1767.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  1768.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  1769.   gtk_widget_show (table);
  1770.  
  1771.   spinbutton =
  1772.     gimp_spin_button_new (&adjustment, edit_min_colors,
  1773.               27.0,
  1774.               gtk_check_version (1, 2, 8) ? 216.0 : 256.0,
  1775.               1.0, 8.0, 0.0, 1.0, 0.0);
  1776.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  1777.               GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
  1778.               &edit_min_colors);
  1779.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  1780.                  _("Minimum Number of Colors:"), 1.0, 0.5,
  1781.                  spinbutton, 1, TRUE);
  1782.  
  1783.   button = gtk_check_button_new_with_label(_("Install Colormap"));
  1784.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1785.                 edit_install_cmap);
  1786.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1787.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1788.               &edit_install_cmap);
  1789.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1790.   gtk_widget_show (button);
  1791.  
  1792.   button = gtk_check_button_new_with_label(_("Colormap Cycling"));
  1793.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1794.                 edit_cycled_marching_ants);
  1795.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1796.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1797.               &edit_cycled_marching_ants);
  1798.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1799.   gtk_widget_show (button);
  1800.  
  1801.  
  1802.   /* Interface */
  1803.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  1804.                       _("Interface"),
  1805.                       GTK_CTREE (ctree),
  1806.                       _("Interface"),
  1807.                       "dialogs/preferences/interface.html",
  1808.                       NULL,
  1809.                       &top_insert,
  1810.                       page_index);
  1811.   gtk_widget_show (vbox);
  1812.   page_index++;
  1813.  
  1814.   vbox2 = prefs_frame_new (_("General"), GTK_BOX (vbox));
  1815.  
  1816.   table = gtk_table_new (4, 2, FALSE);
  1817.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  1818.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  1819.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  1820.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  1821.   gtk_widget_show (table);
  1822.  
  1823.   /* Don't show the Auto-save button until we really 
  1824.      have auto-saving in the gimp.
  1825.  
  1826.      button = gtk_check_button_new_with_label(_("Auto save"));
  1827.      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1828.                                    auto_save);
  1829.      gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1830.      gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1831.                      GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1832.              &auto_save);
  1833.      gtk_widget_show (button);
  1834.   */
  1835.  
  1836.   optionmenu =
  1837.     gimp_option_menu_new2 (FALSE, prefs_preview_size_callback,
  1838.                &preview_size, GINT_TO_POINTER (preview_size),
  1839.  
  1840.                _("None"),   GINT_TO_POINTER (  0), NULL,
  1841.                _("Tiny"),   GINT_TO_POINTER ( 24), NULL,
  1842.                _("Small"),  GINT_TO_POINTER ( 32), NULL,
  1843.                _("Medium"), GINT_TO_POINTER ( 48), NULL,
  1844.                _("Large"),  GINT_TO_POINTER ( 64), NULL,
  1845.                _("Huge"),   GINT_TO_POINTER (128), NULL,
  1846.  
  1847.                NULL);
  1848.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  1849.                  _("Preview Size:"), 1.0, 0.5,
  1850.                  optionmenu, 1, TRUE);
  1851.  
  1852.   optionmenu =
  1853.     gimp_option_menu_new2 (FALSE, prefs_nav_preview_size_callback,
  1854.                &nav_preview_size, GINT_TO_POINTER (nav_preview_size),
  1855.  
  1856.                _("Small"),  GINT_TO_POINTER ( 48), NULL,
  1857.                _("Medium"), GINT_TO_POINTER ( 80), NULL,
  1858.                _("Large"),  GINT_TO_POINTER (112), NULL,
  1859.  
  1860.                NULL);
  1861.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
  1862.                  _("Nav Preview Size:"), 1.0, 0.5,
  1863.                  optionmenu, 1, TRUE);
  1864.  
  1865.   spinbutton =
  1866.     gimp_spin_button_new (&adjustment, edit_last_opened_size,
  1867.               0.0, 16.0, 1.0, 5.0, 0.0, 1.0, 0.0);
  1868.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  1869.               GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
  1870.               &edit_last_opened_size);
  1871.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
  1872.                  _("Recent Documents List Size:"), 1.0, 0.5,
  1873.                  spinbutton, 1, TRUE);
  1874.  
  1875.   /* Indicators */
  1876.   vbox2 = prefs_frame_new (_("Toolbox"), GTK_BOX (vbox));
  1877.  
  1878.   button = gtk_check_button_new_with_label
  1879.     (_("Display Brush, Pattern and Gradient Indicators"));
  1880.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1881.                 edit_show_indicators);
  1882.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1883.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1884.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1885.               &edit_show_indicators);
  1886.   gtk_widget_show (button);
  1887.  
  1888.   vbox2 = prefs_frame_new (_("Dialog Behaviour"), GTK_BOX (vbox));
  1889.  
  1890.   button = gtk_check_button_new_with_label (_("Navigation Window per Display"));
  1891.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1892.                 edit_nav_window_per_display);
  1893.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1894.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1895.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1896.               &edit_nav_window_per_display);
  1897.   gtk_widget_show (button);
  1898.  
  1899.   button = gtk_check_button_new_with_label (_("Info Window Follows Mouse"));
  1900.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1901.                 edit_info_window_follows_mouse);
  1902.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1903.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1904.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1905.               &edit_info_window_follows_mouse);
  1906.   gtk_widget_show (button);
  1907.  
  1908.   /* Interface / Help System */
  1909.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  1910.                       _("Help System"),
  1911.                       GTK_CTREE (ctree),
  1912.                       _("Help System"),
  1913.                       "dialogs/preferences/interface.html#help_system",
  1914.                       top_insert,
  1915.                       &child_insert,
  1916.                       page_index);
  1917.   gtk_widget_show (vbox);
  1918.   page_index++;
  1919.  
  1920.   vbox2 = prefs_frame_new (_("General"), GTK_BOX (vbox));
  1921.  
  1922.   button = gtk_check_button_new_with_label (_("Show Tool Tips"));
  1923.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1924.                 show_tool_tips);
  1925.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1926.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1927.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1928.               &show_tool_tips);
  1929.   gtk_widget_show (button);
  1930.  
  1931.   button =
  1932.     gtk_check_button_new_with_label (_("Context Sensitive Help with \"F1\""));
  1933.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1934.                 use_help);
  1935.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1936.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1937.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1938.               &use_help);
  1939.   gtk_widget_show (button);
  1940.  
  1941.   vbox2 = prefs_frame_new (_("Help Browser"), GTK_BOX (vbox));
  1942.  
  1943.   table = gtk_table_new (1, 2, FALSE);
  1944.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  1945.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  1946.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  1947.   gtk_widget_show (table);
  1948.  
  1949.   optionmenu =
  1950.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  1951.                &help_browser, GINT_TO_POINTER (help_browser),
  1952.  
  1953.                _("Internal"), GINT_TO_POINTER (HELP_BROWSER_GIMP), NULL,
  1954.                _("Netscape"), GINT_TO_POINTER (HELP_BROWSER_NETSCAPE), NULL,
  1955.  
  1956.                NULL);
  1957.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  1958.                  _("Help Browser to Use:"), 1.0, 0.5,
  1959.                  optionmenu, 1, TRUE);
  1960.  
  1961.   /* Interface / Image Windows */
  1962.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  1963.                       _("Image Windows"),
  1964.                       GTK_CTREE (ctree),
  1965.                       _("Image Windows"),
  1966.                       "dialogs/preferences/interface.html#image_windows",
  1967.                       top_insert,
  1968.                       &child_insert,
  1969.                       page_index);
  1970.   gtk_widget_show (vbox);
  1971.   page_index++;
  1972.  
  1973.   vbox2 = prefs_frame_new (_("Appearance"), GTK_BOX (vbox));
  1974.  
  1975.   button = gtk_check_button_new_with_label (_("Use \"Dot for Dot\" by default"));
  1976.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1977.                 default_dot_for_dot);
  1978.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1979.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1980.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1981.               &default_dot_for_dot);
  1982.   gtk_widget_show (button);
  1983.  
  1984.   button = gtk_check_button_new_with_label(_("Resize Window on Zoom"));
  1985.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1986.                 allow_resize_windows);
  1987.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1988.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1989.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1990.               &allow_resize_windows);
  1991.   gtk_widget_show (button);
  1992.  
  1993.   button = gtk_check_button_new_with_label(_("Show Rulers"));
  1994.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  1995.                 show_rulers);
  1996.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  1997.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  1998.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  1999.               &show_rulers);
  2000.   gtk_widget_show (button);
  2001.  
  2002.   button = gtk_check_button_new_with_label(_("Show Statusbar"));
  2003.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2004.                 show_statusbar);
  2005.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2006.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2007.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2008.               &show_statusbar);
  2009.   gtk_widget_show (button);
  2010.  
  2011.   table = gtk_table_new (2, 2, FALSE);
  2012.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  2013.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  2014.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2015.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  2016.   gtk_widget_show (table);
  2017.  
  2018.   spinbutton =
  2019.     gimp_spin_button_new (&adjustment,
  2020.               marching_speed, 50.0, 32000.0, 10.0, 100.0, 1.0,
  2021.               1.0, 0.0);
  2022.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  2023.               GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
  2024.               &marching_speed);
  2025.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  2026.                  _("Marching Ants Speed:"), 1.0, 0.5,
  2027.                  spinbutton, 1, TRUE);
  2028.  
  2029.   /* The title format string */
  2030.   combo = gtk_combo_new ();
  2031.   gtk_combo_set_use_arrows (GTK_COMBO (combo), FALSE);
  2032.   gtk_combo_set_value_in_list (GTK_COMBO (combo), FALSE, FALSE);
  2033.   /* Set the currently used string as "Custom" */
  2034.   comboitem = gtk_list_item_new_with_label (_("Custom"));
  2035.   gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (comboitem),
  2036.                  image_title_format);
  2037.   gtk_container_add (GTK_CONTAINER (GTK_COMBO (combo)->list), comboitem);
  2038.   gtk_widget_show (comboitem);
  2039.   /* set some commonly used format strings */
  2040.   comboitem = gtk_list_item_new_with_label (_("Standard"));
  2041.   gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (comboitem),
  2042.                  "%f-%p.%i (%t)");
  2043.   gtk_container_add(GTK_CONTAINER (GTK_COMBO (combo)->list), comboitem);
  2044.   gtk_widget_show (comboitem);
  2045.   comboitem = gtk_list_item_new_with_label (_("Show zoom percentage"));
  2046.   gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (comboitem),
  2047.                  "%f-%p.%i (%t) %z%%");
  2048.   gtk_container_add (GTK_CONTAINER (GTK_COMBO (combo)->list), comboitem);
  2049.   gtk_widget_show (comboitem);
  2050.   comboitem = gtk_list_item_new_with_label (_("Show zoom ratio"));
  2051.   gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (comboitem),
  2052.                  "%f-%p.%i (%t) %d:%s");
  2053.   gtk_container_add (GTK_CONTAINER (GTK_COMBO (combo)->list), comboitem);
  2054.   gtk_widget_show (comboitem);
  2055.   comboitem = gtk_list_item_new_with_label (_("Show reversed zoom ratio"));
  2056.   gtk_combo_set_item_string (GTK_COMBO (combo), GTK_ITEM (comboitem),
  2057.                  "%f-%p.%i (%t) %s:%d");
  2058.   gtk_container_add (GTK_CONTAINER (GTK_COMBO (combo)->list), comboitem);
  2059.   gtk_widget_show (comboitem);
  2060.  
  2061.   gtk_signal_connect (GTK_OBJECT (GTK_COMBO (combo)->entry), "changed",
  2062.               GTK_SIGNAL_FUNC (prefs_string_callback), 
  2063.               &image_title_format);
  2064.  
  2065.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
  2066.                  _("Image Title Format:"), 1.0, 0.5,
  2067.                  combo, 1, FALSE);
  2068.   /* End of the title format string */
  2069.  
  2070.   vbox2 = prefs_frame_new (_("Pointer Movement Feedback"), GTK_BOX (vbox));
  2071.  
  2072.   button =
  2073.     gtk_check_button_new_with_label (_("Perfect-but-Slow Pointer Tracking"));
  2074.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2075.                 perfectmouse);
  2076.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2077.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2078.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2079.               &perfectmouse);
  2080.   gtk_widget_show (button);
  2081.  
  2082.   button = gtk_check_button_new_with_label (_("Disable Cursor Updating"));
  2083.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2084.                 no_cursor_updating);
  2085.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2086.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2087.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2088.               &no_cursor_updating);
  2089.   gtk_widget_show (button);
  2090.  
  2091.   table = gtk_table_new (1, 2, FALSE);
  2092.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  2093.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2094.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  2095.   gtk_widget_show (table);
  2096.  
  2097.   optionmenu =
  2098.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  2099.                &cursor_mode, GINT_TO_POINTER (cursor_mode),
  2100.  
  2101.                _("Tool Icon"),
  2102.                GINT_TO_POINTER (CURSOR_MODE_TOOL_ICON), NULL,
  2103.                _("Tool Icon with Crosshair"),
  2104.                GINT_TO_POINTER (CURSOR_MODE_TOOL_CROSSHAIR), NULL,
  2105.                _("Crosshair only"),
  2106.                GINT_TO_POINTER (CURSOR_MODE_CROSSHAIR), NULL,
  2107.  
  2108.                NULL);
  2109.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  2110.                  _("Cursor Mode:"), 1.0, 0.5,
  2111.                  optionmenu, 1, TRUE);
  2112.  
  2113.  
  2114.   /* Interface / Tool Options */
  2115.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  2116.                       _("Tool Options"),
  2117.                       GTK_CTREE (ctree),
  2118.                       _("Tool Options"),
  2119.                       "dialogs/preferences/interface.html#tool_options",
  2120.                       top_insert,
  2121.                       &child_insert,
  2122.                       page_index);
  2123.   gtk_widget_show (vbox);
  2124.   page_index++;
  2125.  
  2126.   vbox2 = prefs_frame_new (_("Paint Options"), GTK_BOX (vbox));
  2127.  
  2128.   button =
  2129.     gtk_check_button_new_with_label(_("Use Global Paint Options"));
  2130.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2131.                 global_paint_options);
  2132.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2133.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2134.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2135.               &global_paint_options);
  2136.   gtk_widget_show (button);
  2137.  
  2138.   vbox2 = prefs_frame_new (_("Finding Contiguous Regions"),
  2139.                 GTK_BOX (vbox));
  2140.  
  2141.   table = gtk_table_new (1, 2, FALSE);
  2142.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  2143.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  2144.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2145.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  2146.   gtk_widget_show (table);
  2147.  
  2148.   /*  Default threshold  */
  2149.   spinbutton =
  2150.     gimp_spin_button_new (&adjustment,
  2151.               default_threshold, 0.0, 255.0,
  2152.               1.0, 5.0, 0.0, 1.0, 0.0);
  2153.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  2154.               GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
  2155.               &default_threshold);
  2156.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  2157.                  _("Default Threshold:"), 1.0, 0.5,
  2158.                  spinbutton, 1, TRUE);
  2159.  
  2160.   /* Expand the "Interface" branch */
  2161.   gtk_ctree_expand (GTK_CTREE (ctree), top_insert);
  2162.  
  2163.  
  2164.   /* Environment */
  2165.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  2166.                       _("Environment"),
  2167.                       GTK_CTREE (ctree),
  2168.                       _("Environment"),
  2169.                       "dialogs/preferences/environment.html",
  2170.                       NULL,
  2171.                       &top_insert,
  2172.                       page_index);
  2173.   gtk_widget_show (vbox);
  2174.   page_index++;
  2175.  
  2176.   vbox2 = prefs_frame_new (_("Resource Consumption"), GTK_BOX (vbox));
  2177.  
  2178.   button = gtk_check_button_new_with_label(_("Conservative Memory Usage"));
  2179.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2180.                 edit_stingy_memory_use);
  2181.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2182.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2183.               &edit_stingy_memory_use);
  2184.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2185.   gtk_widget_show (button);
  2186.  
  2187. #ifdef ENABLE_MP
  2188.   table = gtk_table_new (3, 2, FALSE);
  2189. #else
  2190.   table = gtk_table_new (2, 2, FALSE);
  2191. #endif /* ENABLE_MP */
  2192.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  2193.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  2194.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2195.   gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
  2196.   gtk_widget_show (table);
  2197.  
  2198.   /*  Levels of Undo  */
  2199.   spinbutton =
  2200.     gimp_spin_button_new (&adjustment,
  2201.               levels_of_undo, 0.0, 255.0, 1.0, 5.0, 0.0, 1.0, 0.0);
  2202.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  2203.               GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
  2204.               &levels_of_undo);
  2205.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  2206.                  _("Levels of Undo:"), 1.0, 0.5,
  2207.                  spinbutton, 1, TRUE);
  2208.  
  2209.   /*  The tile cache size  */
  2210.   adjustment = gtk_adjustment_new (edit_tile_cache_size, 
  2211.                    0, (4069.0 * 1024 * 1024 - 1), 
  2212.                    1.0, 1.0, 0.0);
  2213.   hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
  2214.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  2215.               GTK_SIGNAL_FUNC (gimp_uint_adjustment_update),
  2216.               &edit_tile_cache_size);
  2217.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
  2218.                  _("Tile Cache Size:"), 1.0, 0.5,
  2219.                  hbox, 1, TRUE);
  2220.  
  2221. #ifdef ENABLE_MP
  2222.   spinbutton =
  2223.     gimp_spin_button_new (&adjustment, num_processors,
  2224.               1, 30, 1.0, 2.0, 0.0, 1.0, 0.0);
  2225.   gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
  2226.               GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
  2227.               &num_processors);
  2228.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
  2229.                  _("Number of Processors to Use:"), 1.0, 0.5,
  2230.                  spinbutton, 1, TRUE);
  2231. #endif /* ENABLE_MP */
  2232.  
  2233.   frame = gtk_frame_new (_("Scaling")); 
  2234.   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  2235.   gtk_widget_show (frame);
  2236.  
  2237.   hbox = gtk_hbox_new (FALSE, 2);
  2238.   gtk_container_add (GTK_CONTAINER (frame), hbox);
  2239.   gtk_widget_show (hbox);
  2240.  
  2241.   table = gtk_table_new (1, 2, FALSE);
  2242.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  2243.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2244.   gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
  2245.   gtk_widget_show (table);
  2246.  
  2247.   optionmenu =
  2248.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  2249.                &interpolation_type, GINT_TO_POINTER (interpolation_type),
  2250.  
  2251.                _("Nearest Neighbor (Fast)"),
  2252.                GINT_TO_POINTER (NEAREST_NEIGHBOR_INTERPOLATION), NULL,
  2253.                _("Linear"),
  2254.                GINT_TO_POINTER (LINEAR_INTERPOLATION), NULL,
  2255.                _("Cubic (Slow)"),
  2256.                GINT_TO_POINTER (CUBIC_INTERPOLATION), NULL,
  2257.  
  2258.                NULL);
  2259.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  2260.                  _("Interpolation Type:"), 1.0, 0.5,
  2261.                  optionmenu, 1, TRUE);
  2262.  
  2263.   vbox2 = prefs_frame_new (_("File Saving"), GTK_BOX (vbox));
  2264.  
  2265.   hbox = gtk_hbox_new (FALSE, 2);
  2266.   gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
  2267.   gtk_widget_show (hbox);
  2268.       
  2269.   table = gtk_table_new (2, 2, FALSE);
  2270.   gtk_container_set_border_width (GTK_CONTAINER (table), 2);
  2271.   gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  2272.   gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2273.   gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
  2274.   gtk_widget_show (table);
  2275.  
  2276.   optionmenu =
  2277.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  2278.                &thumbnail_mode, GINT_TO_POINTER (thumbnail_mode),
  2279.  
  2280.                _("Always"), GINT_TO_POINTER (1), NULL,
  2281.                _("Never"),  GINT_TO_POINTER (0), NULL,
  2282.  
  2283.                NULL);
  2284.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
  2285.                  _("Try to Write a Thumbnail File:"), 1.0, 0.5,
  2286.                  optionmenu, 1, TRUE);
  2287.  
  2288.   optionmenu =
  2289.     gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
  2290.                &trust_dirty_flag, GINT_TO_POINTER (trust_dirty_flag),
  2291.  
  2292.                _("Only when Modified"), GINT_TO_POINTER (1), NULL,
  2293.                _("Always"),             GINT_TO_POINTER (0), NULL,
  2294.  
  2295.                NULL);
  2296.   gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
  2297.                              _("\"File > Save\" Saves the Image:"), 1.0, 0.5,
  2298.                  optionmenu, 1, TRUE);
  2299.                                      
  2300.  
  2301.   /* Session Management */
  2302.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  2303.                       _("Session Management"),
  2304.                       GTK_CTREE (ctree),
  2305.                       _("Session"),
  2306.                       "dialogs/preferences/session.html",
  2307.                       NULL,
  2308.                       &top_insert,
  2309.                       page_index);
  2310.   gtk_widget_show (vbox);
  2311.   page_index++;
  2312.  
  2313.   vbox2 = prefs_frame_new (_("Window Positions"), GTK_BOX (vbox));
  2314.  
  2315.   button = gtk_check_button_new_with_label (_("Save Window Positions on Exit"));
  2316.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2317.                 save_session_info);
  2318.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2319.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2320.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2321.               &save_session_info);
  2322.   gtk_widget_show (button);
  2323.  
  2324.   hbox = gtk_hbox_new (FALSE, 2);
  2325.   gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
  2326.   gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
  2327.   gtk_widget_show (hbox);
  2328.       
  2329.   button = gtk_button_new_with_label (_("Clear Saved Window Positions Now"));
  2330.   gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
  2331.   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
  2332.   gtk_signal_connect (GTK_OBJECT (button), "clicked",
  2333.               GTK_SIGNAL_FUNC (prefs_clear_session_info_callback),
  2334.               NULL);
  2335.   gtk_widget_show (button);
  2336.  
  2337.   button = gtk_check_button_new_with_label (_("Always Try to Restore Session"));
  2338.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2339.                 always_restore_session);
  2340.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2341.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2342.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2343.               &always_restore_session);
  2344.   gtk_widget_show (button);
  2345.  
  2346.   vbox2 = prefs_frame_new (_("Devices"), GTK_BOX (vbox));
  2347.  
  2348.   button = gtk_check_button_new_with_label (_("Save Device Status on Exit"));
  2349.   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
  2350.                 save_device_status);
  2351.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2352.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2353.               GTK_SIGNAL_FUNC (prefs_toggle_callback),
  2354.               &save_device_status);
  2355.   gtk_widget_show (button);
  2356.  
  2357.   /* Monitor */
  2358.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  2359.                       _("Monitor"),
  2360.                       GTK_CTREE (ctree),
  2361.                       _("Monitor"),
  2362.                       "dialogs/preferences/monitor.html",
  2363.                       NULL,
  2364.                       &top_insert,
  2365.                       page_index);
  2366.   gtk_widget_show (vbox);
  2367.   page_index++;
  2368.  
  2369.   vbox2 = prefs_frame_new (_("Get Monitor Resolution"), GTK_BOX (vbox));
  2370.  
  2371.   {
  2372.     gdouble  xres, yres;
  2373.     gchar   *str;
  2374.  
  2375.     gdisplay_xserver_resolution (&xres, &yres);
  2376.  
  2377.     str = g_strdup_printf (_("(Currently %d x %d dpi)"),
  2378.                ROUND (xres), ROUND (yres));
  2379.     label = gtk_label_new (str);
  2380.     g_free (str);
  2381.   }
  2382.  
  2383.   abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
  2384.  
  2385.   sizeentry =
  2386.     gimp_size_entry_new (2, GIMP_UNIT_INCH, pixels_per_unit,
  2387.              FALSE, FALSE, TRUE, 75,
  2388.              GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
  2389.   
  2390.   g_free (pixels_per_unit);
  2391.   pixels_per_unit = NULL;
  2392.  
  2393.   button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
  2394.   if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
  2395.     gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
  2396.    gtk_object_set_data (GTK_OBJECT (sizeentry), "chain_button", button); 
  2397.   gtk_table_attach_defaults (GTK_TABLE (sizeentry), button, 1, 3, 3, 4);
  2398.   gtk_widget_show (button);
  2399.  
  2400.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
  2401.                 _("Horizontal"), 0, 1, 0.0);
  2402.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
  2403.                 _("Vertical"), 0, 2, 0.0);
  2404.   gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
  2405.                 _("dpi"), 1, 4, 0.0);
  2406.  
  2407.   gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
  2408.                      GIMP_MIN_RESOLUTION,
  2409.                      GIMP_MAX_RESOLUTION);
  2410.   gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
  2411.                      GIMP_MIN_RESOLUTION,
  2412.                      GIMP_MAX_RESOLUTION);
  2413.  
  2414.   gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, monitor_xres);
  2415.   gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, monitor_yres);
  2416.  
  2417.   gtk_signal_connect (GTK_OBJECT (sizeentry), "value_changed",
  2418.               GTK_SIGNAL_FUNC (prefs_monitor_resolution_callback),
  2419.               button);
  2420.   gtk_signal_connect (GTK_OBJECT (sizeentry), "refval_changed",
  2421.               GTK_SIGNAL_FUNC (prefs_monitor_resolution_callback),
  2422.               button);
  2423.  
  2424.   gtk_container_add (GTK_CONTAINER (abox), sizeentry);
  2425.   gtk_widget_show (sizeentry);
  2426.   gtk_widget_set_sensitive (sizeentry, !using_xserver_resolution);
  2427.  
  2428.   hbox = gtk_hbox_new (FALSE, 0);
  2429.   gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
  2430.  
  2431.   calibrate_button = gtk_button_new_with_label (_("Calibrate"));
  2432.   gtk_misc_set_padding (GTK_MISC (GTK_BIN (calibrate_button)->child), 4, 0);
  2433.   gtk_signal_connect (GTK_OBJECT (calibrate_button), "clicked",
  2434.               GTK_SIGNAL_FUNC (prefs_resolution_calibrate_callback),
  2435.               sizeentry);
  2436.   gtk_box_pack_start (GTK_BOX (hbox), calibrate_button, FALSE, FALSE, 0);
  2437.   gtk_widget_show (calibrate_button);
  2438.   gtk_widget_set_sensitive (calibrate_button, !using_xserver_resolution);
  2439.  
  2440.   group = NULL;
  2441.   button = gtk_radio_button_new_with_label (group, _("From windowing system"));
  2442.   group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
  2443.   gtk_signal_connect (GTK_OBJECT (button), "toggled",
  2444.               GTK_SIGNAL_FUNC (prefs_res_source_callback),
  2445.               NULL);
  2446.   gtk_object_set_data (GTK_OBJECT (button), "monitor_resolution_sizeentry",
  2447.                sizeentry);
  2448.   gtk_object_set_data (GTK_OBJECT (button), "set_sensitive",
  2449.                label);
  2450.   gtk_object_set_data (GTK_OBJECT (button), "inverse_sensitive",
  2451.                sizeentry);
  2452.   gtk_object_set_data (GTK_OBJECT (sizeentry), "inverse_sensitive",
  2453.                calibrate_button);
  2454.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2455.   gtk_widget_show (button);
  2456.   gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
  2457.   gtk_widget_show (label);
  2458.  
  2459.   separator = gtk_hseparator_new ();
  2460.   gtk_box_pack_start (GTK_BOX (vbox2), separator, FALSE, FALSE, 0);
  2461.   gtk_widget_show (separator);
  2462.  
  2463.   button = gtk_radio_button_new_with_label (group, _("Manually:"));
  2464.   group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
  2465.   gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
  2466.   gtk_widget_show (button);
  2467.  
  2468.   gtk_box_pack_start (GTK_BOX (vbox2), abox, FALSE, FALSE, 0);
  2469.   gtk_widget_show (abox);
  2470.  
  2471.   gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
  2472.   gtk_widget_show (hbox);
  2473.  
  2474.  if (!using_xserver_resolution)
  2475.     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
  2476.  
  2477.   /* Directories */
  2478.   vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  2479.                       _("Directories"),
  2480.                       GTK_CTREE (ctree),
  2481.                       _("Directories"),
  2482.                       "dialogs/preferences/directories.html",
  2483.                       NULL,
  2484.                       &top_insert,
  2485.                       page_index);
  2486.   gtk_widget_show (vbox);
  2487.   page_index++;
  2488.  
  2489.   {
  2490.     static const struct
  2491.     {
  2492.       gchar  *label;
  2493.       gchar  *fs_label;
  2494.       gchar **mdir;
  2495.     }
  2496.     dirs[] =
  2497.     {
  2498.       { N_("Temp Dir:"), N_("Select Temp Dir"), &edit_temp_path },
  2499.       { N_("Swap Dir:"), N_("Select Swap Dir"), &edit_swap_path },
  2500.     };
  2501.     static gint ndirs = sizeof (dirs) / sizeof (dirs[0]);
  2502.  
  2503.     table = gtk_table_new (ndirs + 1, 2, FALSE);
  2504.     gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  2505.     gtk_table_set_col_spacings (GTK_TABLE (table), 4);
  2506.     gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
  2507.     gtk_widget_show (table);
  2508.  
  2509.     for (i = 0; i < ndirs; i++)
  2510.       {
  2511.     fileselection = gimp_file_selection_new (gettext(dirs[i].fs_label),
  2512.                          *(dirs[i].mdir),
  2513.                          TRUE, TRUE);
  2514.     gtk_signal_connect (GTK_OBJECT (fileselection), "filename_changed",
  2515.                 GTK_SIGNAL_FUNC (prefs_filename_callback),
  2516.                 dirs[i].mdir);
  2517.     gimp_table_attach_aligned (GTK_TABLE (table), 0, i,
  2518.                    gettext(dirs[i].label), 1.0, 0.5,
  2519.                    fileselection, 1, FALSE);
  2520.       }
  2521.   }
  2522.  
  2523.   /* Directories / <paths> */
  2524.   {
  2525.     static const struct
  2526.     {
  2527.       gchar  *tree_label;
  2528.       gchar  *label;
  2529.       gchar  *help_data;
  2530.       gchar  *fs_label;
  2531.       gchar **mpath;
  2532.     }
  2533.     paths[] =
  2534.     {
  2535.       { N_("Brushes"), N_("Brushes Directories"),
  2536.     "dialogs/preferences/directories.html#brushes",
  2537.     N_("Select Brushes Dir"),
  2538.     &edit_brush_path },
  2539.       { N_("Generated Brushes"), N_("Generated Brushes Directories"),
  2540.     "dialogs/preferences/directories.html#generated_brushes",
  2541.     N_("Select Generated Brushes Dir"),
  2542.     &edit_brush_vbr_path },
  2543.       { N_("Patterns"), N_("Patterns Directories"),
  2544.     "dialogs/preferences/directories.html#patterns",
  2545.     N_("Select Patterns Dir"),
  2546.     &edit_pattern_path },
  2547.       { N_("Palettes"), N_("Palettes Directories"),
  2548.     "dialogs/preferences/directories.html#palettes",
  2549.     N_("Select Palettes Dir"),
  2550.     &edit_palette_path },
  2551.       { N_("Gradients"), N_("Gradients Directories"),
  2552.     "dialogs/preferences/directories.html#gradients",
  2553.     N_("Select Gradients Dir"),
  2554.     &edit_gradient_path },
  2555.       { N_("Plug-Ins"), N_("Plug-Ins Directories"),
  2556.     "dialogs/preferences/directories.html#plug_ins",
  2557.     N_("Select Plug-Ins Dir"),
  2558.     &edit_plug_in_path },
  2559.       { N_("Modules"), N_("Modules Directories"),
  2560.     "dialogs/preferences/directories.html#modules",
  2561.     N_("Select Modules Dir"),
  2562.     &edit_module_path }
  2563.     };
  2564.     static gint npaths = sizeof (paths) / sizeof (paths[0]);
  2565.     
  2566.     for (i = 0; i < npaths; i++)
  2567.       {
  2568.     vbox = prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
  2569.                         gettext (paths[i].label),
  2570.                         GTK_CTREE (ctree),
  2571.                         gettext (paths[i].tree_label),
  2572.                         paths[i].help_data,
  2573.                         top_insert,
  2574.                         &child_insert,
  2575.                         page_index);
  2576.     gtk_widget_show (vbox);
  2577.     page_index++;
  2578.  
  2579.     patheditor = gimp_path_editor_new (gettext(paths[i].fs_label),
  2580.                        *(paths[i].mpath));
  2581.     gtk_signal_connect (GTK_OBJECT (patheditor), "path_changed",
  2582.                 GTK_SIGNAL_FUNC (prefs_path_callback),
  2583.                 paths[i].mpath);
  2584.     gtk_container_add (GTK_CONTAINER (vbox), patheditor);
  2585.     gtk_widget_show (patheditor);
  2586.       }
  2587.   }
  2588.  
  2589.   /* Recalculate the width of the Category tree now */
  2590.   gtk_clist_set_column_width
  2591.     (GTK_CLIST (ctree), 0, 
  2592.      gtk_clist_optimal_column_width (GTK_CLIST (ctree), 0));
  2593.  
  2594.   gtk_widget_show (ctree);
  2595.   gtk_widget_show (notebook);
  2596.  
  2597.   gtk_widget_show (prefs_dlg);
  2598. }
  2599.